/src/python/WMComponent/DBS3Buffer/DBS3Upload.py

https://github.com/dmwm/WMCore
Python | 50 lines | 18 code | 18 blank | 14 comment | 0 complexity | 9a5dfb23c98468e96232bca624d9effb MD5 | raw file
  1. #!/usr/bin/env python
  2. #pylint: disable=E1101,E1103,C0103,R0902
  3. """
  4. Performs bulk DBS File(s) insertion by :
  5. reading the FJR received in payload
  6. buffering in the database
  7. if buffer has hit the configured limit
  8. """
  9. from __future__ import print_function
  10. import logging
  11. import threading
  12. from WMCore.Agent.Harness import Harness
  13. from WMCore.WMFactory import WMFactory
  14. from WMComponent.DBS3Buffer.DBSUploadPoller import DBSUploadPoller
  15. class DBS3Upload(Harness):
  16. """
  17. Load the poller thread
  18. """
  19. def __init__(self, config):
  20. # call the base class
  21. Harness.__init__(self, config)
  22. self.pollTime = 1
  23. print("DBS3Upload.__init__")
  24. def preInitialization(self):
  25. print("DBS3Upload.preInitialization")
  26. # Add event loop to worker manager
  27. myThread = threading.currentThread()
  28. pollInterval = self.config.DBS3Upload.pollInterval
  29. logging.info("Setting poll interval to %s seconds" % pollInterval)
  30. myThread.workerThreadManager.addWorker(DBSUploadPoller(self.config), pollInterval)
  31. return