/src/python/WMCore/WMSpec/Steps/Templates/DQMUpload.py

https://github.com/PerilousApricot/WMCore-OLDOLD
Python | 99 lines | 67 code | 5 blank | 27 comment | 0 complexity | 2902ca147f2f398edd0d3d62cf052cba MD5 | raw file
  1. #!/usr/bin/env python
  2. """
  3. _DQMUpload_
  4. Template for a DQMUpload Step
  5. """
  6. from WMCore.WMSpec.Steps.Template import Template
  7. from WMCore.WMSpec.Steps.Template import CoreHelper
  8. from WMCore.WMSpec.ConfigSectionTree import nodeName
  9. class DQMUploadStepHelper(CoreHelper):
  10. """
  11. _DQMUploadStepHelper_
  12. Add API calls and helper methods to the basic WMStepHelper to specialise
  13. for DQMUpload tasks
  14. """
  15. def addAnalysisFile(self, infile):
  16. """
  17. Enqueues an analysis file to the DQMUpload step
  18. infile must be a PFN (DQM file)
  19. """
  20. target = self.data.analysisFiles.section_(
  21. "file%i" % self.data.filecount)
  22. target.input = infile
  23. self.data.analysisFiles.filecount += 1
  24. def disableRetries(self):
  25. """
  26. handy for testing, without the 10 minute retry loop
  27. """
  28. self.data.stageOut.retryCount = 1
  29. self.data.stageOut.retryDelay = 0
  30. def disableUpload(self):
  31. """
  32. In case we don't want to upload file to any server
  33. """
  34. self.data.upload.active = False
  35. def disableStageOut(self):
  36. """
  37. In case we don't want to stage out any file
  38. """
  39. self.data.stageOut.active = False
  40. def setProxyFile(self, proxy):
  41. """
  42. Sets the name of the proxy file in the input sandbox
  43. """
  44. self.data.upload.proxy = proxy
  45. def setServerURL(self, url):
  46. """
  47. Sets the URL of the DQM GUI server.
  48. """
  49. self.data.upload.URL = url
  50. class DQMUpload(Template):
  51. """
  52. _DQMUpload_
  53. Tools for creating a template DQMUpload Step
  54. """
  55. def install(self, step):
  56. stepname = nodeName(step)
  57. step.stepType = "DQMUpload"
  58. step.section_("analysisFiles")
  59. step.analysisFiles.filecount = 0
  60. step.section_("upload")
  61. step.upload.active = True
  62. step.upload.URL = 'https://cmsweb.cern.ch/dqm/dev'
  63. step.upload.proxy = None
  64. step.section_("stageOut")
  65. step.stageOut.active = True
  66. step.stageOut.retryCount = 3
  67. step.stageOut.retryDelay = 300
  68. #step.stageOut.waitTime = 1200
  69. def helper(self, step):
  70. """
  71. _helper_
  72. Wrap the WMStep provided in the CMSSW helper class that
  73. includes the ability to add and manipulate the details
  74. of a CMSSW workflow step
  75. """
  76. return DQMUploadStepHelper(step)