/src/python/WMComponent/JobArchiver/JobArchiver.py

https://github.com/PerilousApricot/WMCore
Python | 53 lines | 17 code | 20 blank | 16 comment | 0 complexity | c6584927e3b822e6a74befc1fad14609 MD5 | raw file
  1. #!/usr/bin/env python
  2. """
  3. Checks for finished jobs
  4. Upon finding jobs cleans out their logs.
  5. """
  6. import logging
  7. import threading
  8. from WMCore.Agent.Harness import Harness
  9. from WMComponent.JobArchiver.JobArchiverPoller import JobArchiverPoller
  10. #from WMCore.WorkQueue.WorkQueue import WorkQueue
  11. class JobArchiver(Harness):
  12. """
  13. Checks for finished jobs
  14. Upon finding jobs cleans out their logs.
  15. """
  16. def __init__(self, config):
  17. # call the base class
  18. Harness.__init__(self, config)
  19. self.pollTime = 1
  20. self.config = config
  21. print "JobArchiver.__init__"
  22. def preInitialization(self):
  23. """
  24. Handles the setup of the worker thread.
  25. """
  26. logging.info("JobArchiver.preInitialization")
  27. # Add event loop to worker manager
  28. myThread = threading.currentThread()
  29. pollInterval = self.config.JobArchiver.pollInterval
  30. logging.info("Setting poll interval to %s seconds" % pollInterval)
  31. myThread.workerThreadManager.addWorker(JobArchiverPoller(self.config), pollInterval)
  32. return