/src/python/WMComponent/JobArchiver/JobArchiver.py
Python | 53 lines | 17 code | 20 blank | 16 comment | 0 complexity | c6584927e3b822e6a74befc1fad14609 MD5 | raw file
- #!/usr/bin/env python
- """
- Checks for finished jobs
- Upon finding jobs cleans out their logs.
- """
- import logging
- import threading
- from WMCore.Agent.Harness import Harness
- from WMComponent.JobArchiver.JobArchiverPoller import JobArchiverPoller
- #from WMCore.WorkQueue.WorkQueue import WorkQueue
- class JobArchiver(Harness):
- """
- Checks for finished jobs
- Upon finding jobs cleans out their logs.
- """
- def __init__(self, config):
- # call the base class
- Harness.__init__(self, config)
- self.pollTime = 1
- self.config = config
- print "JobArchiver.__init__"
- def preInitialization(self):
- """
- Handles the setup of the worker thread.
- """
- logging.info("JobArchiver.preInitialization")
- # Add event loop to worker manager
- myThread = threading.currentThread()
- pollInterval = self.config.JobArchiver.pollInterval
- logging.info("Setting poll interval to %s seconds" % pollInterval)
- myThread.workerThreadManager.addWorker(JobArchiverPoller(self.config), pollInterval)
- return