/src/python/WMComponent/JobSubmitter/JobSubmitter.py

https://github.com/PerilousApricot/WMCore
Python | 49 lines | 17 code | 15 blank | 17 comment | 0 complexity | dfc635e4d12becb9394f3bd587edb928 MD5 | raw file
  1. #!/usr/bin/env python
  2. #pylint: disable-msg=W6501
  3. # W6501: pass information to logging using string arguments
  4. """
  5. Creates jobs for new subscriptions
  6. """
  7. import logging
  8. import threading
  9. from WMCore.Agent.Harness import Harness
  10. from WMComponent.JobSubmitter.JobSubmitterPoller import JobSubmitterPoller
  11. class JobSubmitter(Harness):
  12. """
  13. Creates jobs for new subscriptions
  14. """
  15. def __init__(self, config):
  16. # call the base class
  17. Harness.__init__(self, config)
  18. self.pollTime = 1
  19. logging.info("JobSubmitter.__init__")
  20. def preInitialization(self):
  21. """
  22. Setup the worker thread for jobSubmitter
  23. """
  24. logging.info("JobSubmitter.preInitialization")
  25. # Add event loop to worker manager
  26. myThread = threading.currentThread()
  27. pollInterval = self.config.JobSubmitter.pollInterval
  28. logging.info("Setting poll interval to %s seconds" % pollInterval)
  29. myThread.workerThreadManager.addWorker(JobSubmitterPoller(self.config),
  30. pollInterval)
  31. return