wmglobalqueue 2.4.5.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (347) hide show
  1. Utils/CPMetrics.py +270 -0
  2. Utils/CertTools.py +100 -0
  3. Utils/EmailAlert.py +50 -0
  4. Utils/ExtendedUnitTestCase.py +62 -0
  5. Utils/FileTools.py +182 -0
  6. Utils/IteratorTools.py +80 -0
  7. Utils/MathUtils.py +31 -0
  8. Utils/MemoryCache.py +119 -0
  9. Utils/Patterns.py +24 -0
  10. Utils/Pipeline.py +137 -0
  11. Utils/PortForward.py +97 -0
  12. Utils/ProcFS.py +112 -0
  13. Utils/ProcessStats.py +194 -0
  14. Utils/PythonVersion.py +17 -0
  15. Utils/Signals.py +36 -0
  16. Utils/TemporaryEnvironment.py +27 -0
  17. Utils/Throttled.py +227 -0
  18. Utils/Timers.py +130 -0
  19. Utils/Timestamps.py +86 -0
  20. Utils/TokenManager.py +143 -0
  21. Utils/Tracing.py +60 -0
  22. Utils/TwPrint.py +98 -0
  23. Utils/Utilities.py +318 -0
  24. Utils/__init__.py +11 -0
  25. Utils/wmcoreDTools.py +707 -0
  26. WMCore/ACDC/Collection.py +57 -0
  27. WMCore/ACDC/CollectionTypes.py +12 -0
  28. WMCore/ACDC/CouchCollection.py +67 -0
  29. WMCore/ACDC/CouchFileset.py +238 -0
  30. WMCore/ACDC/CouchService.py +73 -0
  31. WMCore/ACDC/DataCollectionService.py +485 -0
  32. WMCore/ACDC/Fileset.py +94 -0
  33. WMCore/ACDC/__init__.py +11 -0
  34. WMCore/Algorithms/Alarm.py +39 -0
  35. WMCore/Algorithms/MathAlgos.py +274 -0
  36. WMCore/Algorithms/MiscAlgos.py +67 -0
  37. WMCore/Algorithms/ParseXMLFile.py +115 -0
  38. WMCore/Algorithms/Permissions.py +27 -0
  39. WMCore/Algorithms/Singleton.py +58 -0
  40. WMCore/Algorithms/SubprocessAlgos.py +129 -0
  41. WMCore/Algorithms/__init__.py +7 -0
  42. WMCore/Cache/GenericDataCache.py +98 -0
  43. WMCore/Cache/WMConfigCache.py +572 -0
  44. WMCore/Cache/__init__.py +0 -0
  45. WMCore/Configuration.py +659 -0
  46. WMCore/DAOFactory.py +47 -0
  47. WMCore/DataStructs/File.py +177 -0
  48. WMCore/DataStructs/Fileset.py +140 -0
  49. WMCore/DataStructs/Job.py +182 -0
  50. WMCore/DataStructs/JobGroup.py +142 -0
  51. WMCore/DataStructs/JobPackage.py +49 -0
  52. WMCore/DataStructs/LumiList.py +734 -0
  53. WMCore/DataStructs/Mask.py +219 -0
  54. WMCore/DataStructs/MathStructs/ContinuousSummaryHistogram.py +197 -0
  55. WMCore/DataStructs/MathStructs/DiscreteSummaryHistogram.py +92 -0
  56. WMCore/DataStructs/MathStructs/SummaryHistogram.py +117 -0
  57. WMCore/DataStructs/MathStructs/__init__.py +0 -0
  58. WMCore/DataStructs/Pickleable.py +24 -0
  59. WMCore/DataStructs/Run.py +256 -0
  60. WMCore/DataStructs/Subscription.py +175 -0
  61. WMCore/DataStructs/WMObject.py +47 -0
  62. WMCore/DataStructs/WorkUnit.py +112 -0
  63. WMCore/DataStructs/Workflow.py +60 -0
  64. WMCore/DataStructs/__init__.py +8 -0
  65. WMCore/Database/CMSCouch.py +1430 -0
  66. WMCore/Database/ConfigDBMap.py +29 -0
  67. WMCore/Database/CouchMonitoring.py +450 -0
  68. WMCore/Database/CouchUtils.py +118 -0
  69. WMCore/Database/DBCore.py +198 -0
  70. WMCore/Database/DBCreator.py +113 -0
  71. WMCore/Database/DBExceptionHandler.py +59 -0
  72. WMCore/Database/DBFactory.py +117 -0
  73. WMCore/Database/DBFormatter.py +177 -0
  74. WMCore/Database/Dialects.py +13 -0
  75. WMCore/Database/ExecuteDAO.py +327 -0
  76. WMCore/Database/MongoDB.py +241 -0
  77. WMCore/Database/MySQL/Destroy.py +42 -0
  78. WMCore/Database/MySQL/ListUserContent.py +20 -0
  79. WMCore/Database/MySQL/__init__.py +9 -0
  80. WMCore/Database/MySQLCore.py +132 -0
  81. WMCore/Database/Oracle/Destroy.py +56 -0
  82. WMCore/Database/Oracle/ListUserContent.py +19 -0
  83. WMCore/Database/Oracle/__init__.py +9 -0
  84. WMCore/Database/ResultSet.py +44 -0
  85. WMCore/Database/Transaction.py +91 -0
  86. WMCore/Database/__init__.py +9 -0
  87. WMCore/Database/ipy_profile_couch.py +438 -0
  88. WMCore/GlobalWorkQueue/CherryPyThreads/CleanUpTask.py +29 -0
  89. WMCore/GlobalWorkQueue/CherryPyThreads/HeartbeatMonitor.py +105 -0
  90. WMCore/GlobalWorkQueue/CherryPyThreads/LocationUpdateTask.py +28 -0
  91. WMCore/GlobalWorkQueue/CherryPyThreads/ReqMgrInteractionTask.py +35 -0
  92. WMCore/GlobalWorkQueue/CherryPyThreads/__init__.py +0 -0
  93. WMCore/GlobalWorkQueue/__init__.py +0 -0
  94. WMCore/GroupUser/CouchObject.py +127 -0
  95. WMCore/GroupUser/Decorators.py +51 -0
  96. WMCore/GroupUser/Group.py +33 -0
  97. WMCore/GroupUser/Interface.py +73 -0
  98. WMCore/GroupUser/User.py +96 -0
  99. WMCore/GroupUser/__init__.py +11 -0
  100. WMCore/Lexicon.py +836 -0
  101. WMCore/REST/Auth.py +202 -0
  102. WMCore/REST/CherryPyPeriodicTask.py +166 -0
  103. WMCore/REST/Error.py +333 -0
  104. WMCore/REST/Format.py +642 -0
  105. WMCore/REST/HeartbeatMonitorBase.py +90 -0
  106. WMCore/REST/Main.py +636 -0
  107. WMCore/REST/Server.py +2435 -0
  108. WMCore/REST/Services.py +24 -0
  109. WMCore/REST/Test.py +120 -0
  110. WMCore/REST/Tools.py +38 -0
  111. WMCore/REST/Validation.py +250 -0
  112. WMCore/REST/__init__.py +1 -0
  113. WMCore/ReqMgr/DataStructs/RequestStatus.py +209 -0
  114. WMCore/ReqMgr/DataStructs/RequestType.py +13 -0
  115. WMCore/ReqMgr/DataStructs/__init__.py +0 -0
  116. WMCore/ReqMgr/__init__.py +1 -0
  117. WMCore/Services/AlertManager/AlertManagerAPI.py +111 -0
  118. WMCore/Services/AlertManager/__init__.py +0 -0
  119. WMCore/Services/CRIC/CRIC.py +238 -0
  120. WMCore/Services/CRIC/__init__.py +0 -0
  121. WMCore/Services/DBS/DBS3Reader.py +1044 -0
  122. WMCore/Services/DBS/DBSConcurrency.py +44 -0
  123. WMCore/Services/DBS/DBSErrors.py +112 -0
  124. WMCore/Services/DBS/DBSReader.py +23 -0
  125. WMCore/Services/DBS/DBSUtils.py +166 -0
  126. WMCore/Services/DBS/DBSWriterObjects.py +381 -0
  127. WMCore/Services/DBS/ProdException.py +133 -0
  128. WMCore/Services/DBS/__init__.py +8 -0
  129. WMCore/Services/FWJRDB/FWJRDBAPI.py +118 -0
  130. WMCore/Services/FWJRDB/__init__.py +0 -0
  131. WMCore/Services/HTTPS/HTTPSAuthHandler.py +66 -0
  132. WMCore/Services/HTTPS/__init__.py +0 -0
  133. WMCore/Services/LogDB/LogDB.py +201 -0
  134. WMCore/Services/LogDB/LogDBBackend.py +191 -0
  135. WMCore/Services/LogDB/LogDBExceptions.py +11 -0
  136. WMCore/Services/LogDB/LogDBReport.py +85 -0
  137. WMCore/Services/LogDB/__init__.py +0 -0
  138. WMCore/Services/MSPileup/__init__.py +0 -0
  139. WMCore/Services/MSUtils/MSUtils.py +54 -0
  140. WMCore/Services/MSUtils/__init__.py +0 -0
  141. WMCore/Services/McM/McM.py +173 -0
  142. WMCore/Services/McM/__init__.py +8 -0
  143. WMCore/Services/MonIT/Grafana.py +133 -0
  144. WMCore/Services/MonIT/__init__.py +0 -0
  145. WMCore/Services/PyCondor/PyCondorAPI.py +154 -0
  146. WMCore/Services/PyCondor/__init__.py +0 -0
  147. WMCore/Services/ReqMgr/ReqMgr.py +261 -0
  148. WMCore/Services/ReqMgr/__init__.py +0 -0
  149. WMCore/Services/ReqMgrAux/ReqMgrAux.py +419 -0
  150. WMCore/Services/ReqMgrAux/__init__.py +0 -0
  151. WMCore/Services/RequestDB/RequestDBReader.py +267 -0
  152. WMCore/Services/RequestDB/RequestDBWriter.py +39 -0
  153. WMCore/Services/RequestDB/__init__.py +0 -0
  154. WMCore/Services/Requests.py +624 -0
  155. WMCore/Services/Rucio/Rucio.py +1290 -0
  156. WMCore/Services/Rucio/RucioUtils.py +74 -0
  157. WMCore/Services/Rucio/__init__.py +0 -0
  158. WMCore/Services/RucioConMon/RucioConMon.py +121 -0
  159. WMCore/Services/RucioConMon/__init__.py +0 -0
  160. WMCore/Services/Service.py +400 -0
  161. WMCore/Services/StompAMQ/__init__.py +0 -0
  162. WMCore/Services/TagCollector/TagCollector.py +155 -0
  163. WMCore/Services/TagCollector/XMLUtils.py +98 -0
  164. WMCore/Services/TagCollector/__init__.py +0 -0
  165. WMCore/Services/UUIDLib.py +13 -0
  166. WMCore/Services/UserFileCache/UserFileCache.py +160 -0
  167. WMCore/Services/UserFileCache/__init__.py +8 -0
  168. WMCore/Services/WMAgent/WMAgent.py +63 -0
  169. WMCore/Services/WMAgent/__init__.py +0 -0
  170. WMCore/Services/WMArchive/CMSSWMetrics.py +526 -0
  171. WMCore/Services/WMArchive/DataMap.py +463 -0
  172. WMCore/Services/WMArchive/WMArchive.py +33 -0
  173. WMCore/Services/WMArchive/__init__.py +0 -0
  174. WMCore/Services/WMBS/WMBS.py +97 -0
  175. WMCore/Services/WMBS/__init__.py +0 -0
  176. WMCore/Services/WMStats/DataStruct/RequestInfoCollection.py +300 -0
  177. WMCore/Services/WMStats/DataStruct/__init__.py +0 -0
  178. WMCore/Services/WMStats/WMStatsPycurl.py +145 -0
  179. WMCore/Services/WMStats/WMStatsReader.py +445 -0
  180. WMCore/Services/WMStats/WMStatsWriter.py +273 -0
  181. WMCore/Services/WMStats/__init__.py +0 -0
  182. WMCore/Services/WMStatsServer/WMStatsServer.py +134 -0
  183. WMCore/Services/WMStatsServer/__init__.py +0 -0
  184. WMCore/Services/WorkQueue/WorkQueue.py +492 -0
  185. WMCore/Services/WorkQueue/__init__.py +0 -0
  186. WMCore/Services/__init__.py +8 -0
  187. WMCore/Services/pycurl_manager.py +574 -0
  188. WMCore/WMBase.py +50 -0
  189. WMCore/WMConnectionBase.py +164 -0
  190. WMCore/WMException.py +183 -0
  191. WMCore/WMExceptions.py +269 -0
  192. WMCore/WMFactory.py +76 -0
  193. WMCore/WMInit.py +377 -0
  194. WMCore/WMLogging.py +104 -0
  195. WMCore/WMSpec/ConfigSectionTree.py +442 -0
  196. WMCore/WMSpec/Persistency.py +135 -0
  197. WMCore/WMSpec/Steps/BuildMaster.py +87 -0
  198. WMCore/WMSpec/Steps/BuildTools.py +201 -0
  199. WMCore/WMSpec/Steps/Builder.py +97 -0
  200. WMCore/WMSpec/Steps/Diagnostic.py +89 -0
  201. WMCore/WMSpec/Steps/Emulator.py +62 -0
  202. WMCore/WMSpec/Steps/ExecuteMaster.py +208 -0
  203. WMCore/WMSpec/Steps/Executor.py +210 -0
  204. WMCore/WMSpec/Steps/StepFactory.py +213 -0
  205. WMCore/WMSpec/Steps/TaskEmulator.py +75 -0
  206. WMCore/WMSpec/Steps/Template.py +204 -0
  207. WMCore/WMSpec/Steps/Templates/AlcaHarvest.py +76 -0
  208. WMCore/WMSpec/Steps/Templates/CMSSW.py +613 -0
  209. WMCore/WMSpec/Steps/Templates/DQMUpload.py +59 -0
  210. WMCore/WMSpec/Steps/Templates/DeleteFiles.py +70 -0
  211. WMCore/WMSpec/Steps/Templates/LogArchive.py +84 -0
  212. WMCore/WMSpec/Steps/Templates/LogCollect.py +105 -0
  213. WMCore/WMSpec/Steps/Templates/StageOut.py +105 -0
  214. WMCore/WMSpec/Steps/Templates/__init__.py +10 -0
  215. WMCore/WMSpec/Steps/WMExecutionFailure.py +21 -0
  216. WMCore/WMSpec/Steps/__init__.py +8 -0
  217. WMCore/WMSpec/Utilities.py +63 -0
  218. WMCore/WMSpec/WMSpecErrors.py +12 -0
  219. WMCore/WMSpec/WMStep.py +347 -0
  220. WMCore/WMSpec/WMTask.py +1997 -0
  221. WMCore/WMSpec/WMWorkload.py +2288 -0
  222. WMCore/WMSpec/WMWorkloadTools.py +382 -0
  223. WMCore/WMSpec/__init__.py +9 -0
  224. WMCore/WorkQueue/DataLocationMapper.py +273 -0
  225. WMCore/WorkQueue/DataStructs/ACDCBlock.py +47 -0
  226. WMCore/WorkQueue/DataStructs/Block.py +48 -0
  227. WMCore/WorkQueue/DataStructs/CouchWorkQueueElement.py +148 -0
  228. WMCore/WorkQueue/DataStructs/WorkQueueElement.py +274 -0
  229. WMCore/WorkQueue/DataStructs/WorkQueueElementResult.py +152 -0
  230. WMCore/WorkQueue/DataStructs/WorkQueueElementsSummary.py +185 -0
  231. WMCore/WorkQueue/DataStructs/__init__.py +0 -0
  232. WMCore/WorkQueue/Policy/End/EndPolicyInterface.py +44 -0
  233. WMCore/WorkQueue/Policy/End/SingleShot.py +22 -0
  234. WMCore/WorkQueue/Policy/End/__init__.py +32 -0
  235. WMCore/WorkQueue/Policy/PolicyInterface.py +17 -0
  236. WMCore/WorkQueue/Policy/Start/Block.py +258 -0
  237. WMCore/WorkQueue/Policy/Start/Dataset.py +180 -0
  238. WMCore/WorkQueue/Policy/Start/MonteCarlo.py +131 -0
  239. WMCore/WorkQueue/Policy/Start/ResubmitBlock.py +171 -0
  240. WMCore/WorkQueue/Policy/Start/StartPolicyInterface.py +316 -0
  241. WMCore/WorkQueue/Policy/Start/__init__.py +34 -0
  242. WMCore/WorkQueue/Policy/__init__.py +57 -0
  243. WMCore/WorkQueue/WMBSHelper.py +772 -0
  244. WMCore/WorkQueue/WorkQueue.py +1237 -0
  245. WMCore/WorkQueue/WorkQueueBackend.py +750 -0
  246. WMCore/WorkQueue/WorkQueueBase.py +39 -0
  247. WMCore/WorkQueue/WorkQueueExceptions.py +44 -0
  248. WMCore/WorkQueue/WorkQueueReqMgrInterface.py +278 -0
  249. WMCore/WorkQueue/WorkQueueUtils.py +130 -0
  250. WMCore/WorkQueue/__init__.py +13 -0
  251. WMCore/Wrappers/JsonWrapper/JSONThunker.py +342 -0
  252. WMCore/Wrappers/JsonWrapper/__init__.py +7 -0
  253. WMCore/Wrappers/__init__.py +6 -0
  254. WMCore/__init__.py +10 -0
  255. wmglobalqueue-2.4.5.1.data/data/bin/wmc-dist-patch +15 -0
  256. wmglobalqueue-2.4.5.1.data/data/bin/wmc-dist-unpatch +8 -0
  257. wmglobalqueue-2.4.5.1.data/data/bin/wmc-httpd +3 -0
  258. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/.couchapprc +1 -0
  259. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/README.md +40 -0
  260. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/_attachments/index.html +264 -0
  261. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/_attachments/js/ElementInfoByWorkflow.js +96 -0
  262. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/_attachments/js/StuckElementInfo.js +57 -0
  263. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/_attachments/js/WorkloadInfoTable.js +80 -0
  264. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/_attachments/js/dataTable.js +70 -0
  265. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/_attachments/js/namespace.js +23 -0
  266. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/_attachments/style/main.css +75 -0
  267. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/couchapp.json +4 -0
  268. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/filters/childQueueFilter.js +13 -0
  269. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/filters/filterDeletedDocs.js +3 -0
  270. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/filters/queueFilter.js +11 -0
  271. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/language +1 -0
  272. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/lib/mustache.js +333 -0
  273. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/lib/validate.js +27 -0
  274. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/lib/workqueue_utils.js +61 -0
  275. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/lists/elementsDetail.js +28 -0
  276. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/lists/filter.js +86 -0
  277. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/lists/stuckElements.js +38 -0
  278. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/lists/workRestrictions.js +153 -0
  279. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/lists/workflowSummary.js +28 -0
  280. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/rewrites.json +73 -0
  281. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/shows/redirect.js +23 -0
  282. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/shows/status.js +40 -0
  283. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/templates/ElementSummaryByWorkflow.html +27 -0
  284. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/templates/StuckElementSummary.html +26 -0
  285. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/templates/TaskStatus.html +23 -0
  286. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/templates/WorkflowSummary.html +27 -0
  287. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/templates/partials/workqueue-common-lib.html +2 -0
  288. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/templates/partials/yui-lib-remote.html +16 -0
  289. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/templates/partials/yui-lib.html +18 -0
  290. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/updates/in-place.js +50 -0
  291. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/validate_doc_update.js +8 -0
  292. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/vendor/couchapp/_attachments/jquery.couch.app.js +235 -0
  293. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/vendor/couchapp/_attachments/jquery.pathbinder.js +173 -0
  294. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/activeData/map.js +8 -0
  295. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/activeData/reduce.js +2 -0
  296. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/activeParentData/map.js +8 -0
  297. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/activeParentData/reduce.js +2 -0
  298. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/activePileupData/map.js +8 -0
  299. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/activePileupData/reduce.js +2 -0
  300. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/analyticsData/map.js +11 -0
  301. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/analyticsData/reduce.js +1 -0
  302. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/availableByPriority/map.js +6 -0
  303. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/conflicts/map.js +5 -0
  304. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/elements/map.js +5 -0
  305. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/elementsByData/map.js +8 -0
  306. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/elementsByParent/map.js +8 -0
  307. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/elementsByParentData/map.js +8 -0
  308. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/elementsByPileupData/map.js +8 -0
  309. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/elementsByStatus/map.js +8 -0
  310. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/elementsBySubscription/map.js +6 -0
  311. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/elementsByWorkflow/map.js +8 -0
  312. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/elementsByWorkflow/reduce.js +3 -0
  313. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/elementsDetailByWorkflowAndStatus/map.js +26 -0
  314. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/jobInjectStatusByRequest/map.js +10 -0
  315. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/jobInjectStatusByRequest/reduce.js +1 -0
  316. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/jobStatusByRequest/map.js +6 -0
  317. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/jobStatusByRequest/reduce.js +1 -0
  318. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/jobsByChildQueueAndPriority/map.js +6 -0
  319. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/jobsByChildQueueAndPriority/reduce.js +1 -0
  320. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/jobsByChildQueueAndStatus/map.js +6 -0
  321. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/jobsByChildQueueAndStatus/reduce.js +1 -0
  322. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/jobsByRequest/map.js +6 -0
  323. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/jobsByRequest/reduce.js +1 -0
  324. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/jobsByStatus/map.js +6 -0
  325. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/jobsByStatus/reduce.js +1 -0
  326. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/jobsByStatusAndPriority/map.js +6 -0
  327. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/jobsByStatusAndPriority/reduce.js +1 -0
  328. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/openRequests/map.js +6 -0
  329. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/recent-items/map.js +5 -0
  330. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/siteWhitelistByRequest/map.js +6 -0
  331. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/siteWhitelistByRequest/reduce.js +1 -0
  332. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/specsByWorkflow/map.js +5 -0
  333. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/stuckElements/map.js +38 -0
  334. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/wmbsInjectStatusByRequest/map.js +12 -0
  335. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/wmbsInjectStatusByRequest/reduce.js +3 -0
  336. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/wmbsUrl/map.js +6 -0
  337. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/wmbsUrl/reduce.js +2 -0
  338. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/wmbsUrlByRequest/map.js +6 -0
  339. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/wmbsUrlByRequest/reduce.js +2 -0
  340. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/workflowSummary/map.js +9 -0
  341. wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/workflowSummary/reduce.js +10 -0
  342. wmglobalqueue-2.4.5.1.dist-info/METADATA +26 -0
  343. wmglobalqueue-2.4.5.1.dist-info/RECORD +347 -0
  344. wmglobalqueue-2.4.5.1.dist-info/WHEEL +5 -0
  345. wmglobalqueue-2.4.5.1.dist-info/licenses/LICENSE +202 -0
  346. wmglobalqueue-2.4.5.1.dist-info/licenses/NOTICE +16 -0
  347. wmglobalqueue-2.4.5.1.dist-info/top_level.txt +2 -0
@@ -0,0 +1,177 @@
1
+ #!/usr/bin/env python
2
+ """
3
+ _File_
4
+
5
+ Data object that contains details for a single file
6
+
7
+ """
8
+ from builtins import str, bytes
9
+ __all__ = []
10
+
11
+ from WMCore.DataStructs.Run import Run
12
+ from WMCore.DataStructs.WMObject import WMObject
13
+
14
+
15
+ class File(WMObject, dict):
16
+ """
17
+ _File_
18
+ Data object that contains details for a single file
19
+
20
+ TODO
21
+ - use the decorator `from functools import total_ordering` after
22
+ dropping support for python 2.6
23
+ - then, drop __ne__, __le__, __gt__, __ge__
24
+ """
25
+
26
+ def __init__(self, lfn="", size=0, events=0, checksums=None,
27
+ parents=None, locations=None, merged=False):
28
+ dict.__init__(self)
29
+ checksums = checksums or {}
30
+ self.setdefault("lfn", lfn)
31
+ self.setdefault("size", size)
32
+ self.setdefault("events", events)
33
+ self.setdefault("checksums", checksums)
34
+ self.setdefault('runs', set())
35
+ self.setdefault('merged', merged)
36
+ self.setdefault('last_event', 0)
37
+ self.setdefault('first_event', 0)
38
+ if locations is None:
39
+ self.setdefault("locations", set())
40
+ else:
41
+ self.setdefault("locations", locations)
42
+
43
+ if parents is None:
44
+ self.setdefault("parents", set())
45
+ else:
46
+ self.setdefault("parents", parents)
47
+
48
+ def addRun(self, run):
49
+ """
50
+ _addRun_
51
+
52
+ run should be an instance of WMCore.DataStructs.Run
53
+
54
+ Add a run container to this file, tweak the run and lumi
55
+ keys to be max run and max lumi for backwards compat.
56
+
57
+
58
+ """
59
+
60
+ if not isinstance(run, Run):
61
+ msg = "addRun argument must be of type WMCore.DataStructs.Run"
62
+ raise RuntimeError(msg)
63
+
64
+ addFlag = False
65
+ for runMember in self['runs']:
66
+ if runMember.run == run.run:
67
+ # this rely on Run object overwrite __add__ to update self
68
+ runMember + run
69
+ addFlag = True
70
+
71
+ if not addFlag:
72
+ self['runs'].add(run)
73
+ return
74
+
75
+ def load(self):
76
+ """
77
+ A DataStructs file has nothing to load from, other implementations will
78
+ over-ride this method.
79
+ """
80
+ if self['id']:
81
+ self['lfn'] = '/store/testing/%s' % self['id']
82
+
83
+ def save(self):
84
+ """
85
+ A DataStructs file has nothing to save to, other implementations will
86
+ over-ride this method.
87
+ """
88
+ pass
89
+
90
+ def setLocation(self, pnn):
91
+ # Make sure we don't add None, [], "" as file location
92
+ if pnn:
93
+ self['locations'] = self['locations'] | set(self.makelist(pnn))
94
+
95
+ def __eq__(self, rhs):
96
+ """
97
+ File is equal if it has the same name
98
+ """
99
+ eq = False
100
+ if isinstance(rhs, type(self)):
101
+ eq = self['lfn'] == rhs['lfn']
102
+ elif isinstance(rhs, (str, bytes)):
103
+ eq = self['lfn'] == rhs
104
+ return eq
105
+
106
+ def __ne__(self, rhs):
107
+ return not self.__eq__(rhs)
108
+
109
+ def __hash__(self):
110
+ thisHash = self['lfn'].__hash__()
111
+ return thisHash
112
+
113
+ def __lt__(self, rhs):
114
+ """
115
+ Sort files based on lexicographical ordering of the value connected
116
+ to the 'lfn' key
117
+ """
118
+ eq = False
119
+ if isinstance(rhs, type(self)):
120
+ eq = self['lfn'] < rhs['lfn']
121
+ elif isinstance(rhs, (str, bytes)):
122
+ eq = self['lfn'] < rhs
123
+ return eq
124
+
125
+ def __le__(self, other):
126
+ return self.__lt__(other) or self.__eq__(other)
127
+
128
+ def __gt__(self, other):
129
+ return not self.__le__(other)
130
+
131
+ def __ge__(self, other):
132
+ return not self.__lt__(other)
133
+
134
+ def json(self, thunker=None):
135
+ """
136
+ _json_
137
+
138
+ Serialize the file object. This will convert all Sets() to lists and
139
+ weed out the internal data structures that don't need to be shared.
140
+ """
141
+ fileDict = {"last_event": self["last_event"],
142
+ "first_event": self["first_event"],
143
+ "lfn": self["lfn"],
144
+ "locations": list(self["locations"]),
145
+ "id": self.get("id", None),
146
+ "checksums": self["checksums"],
147
+ "events": self["events"],
148
+ "merged": self["merged"],
149
+ "size": self["size"],
150
+ "runs": [],
151
+ "parents": []}
152
+
153
+ for parent in self["parents"]:
154
+ if isinstance(parent, (str, bytes)):
155
+ # Then for some reason, we're passing strings
156
+ # Done specifically for ErrorHandler
157
+ fileDict['parents'].append(parent)
158
+ elif thunker is None:
159
+ continue
160
+ else:
161
+ fileDict["parents"].append(thunker._thunk(parent))
162
+
163
+ for run in self["runs"]:
164
+ runDict = {"run_number": run.run,
165
+ "lumis": run.lumis}
166
+ fileDict["runs"].append(runDict)
167
+
168
+ return fileDict
169
+
170
+ def __to_json__(self, thunker=None):
171
+ """
172
+ __to_json__
173
+
174
+ This is the standard way we jsonize other objects.
175
+ Included here so we have a uniform method.
176
+ """
177
+ return self.json(thunker)
@@ -0,0 +1,140 @@
1
+ #!/usr/bin/env python
2
+ """
3
+ _Fileset_
4
+
5
+ Data object that contains a set of files
6
+
7
+ """
8
+
9
+ from __future__ import print_function
10
+ from builtins import str, map
11
+
12
+ from operator import itemgetter
13
+ from WMCore.DataStructs.WMObject import WMObject
14
+ __all__ = []
15
+
16
+
17
+ class Fileset(WMObject):
18
+ """
19
+ _Fileset_
20
+ Data object that contains a set of files
21
+ """
22
+ def __init__(self, name=None, files=None):
23
+ """
24
+ Assume input files are new
25
+ """
26
+ self.name = name
27
+ self.files = set()
28
+
29
+ if files is None:
30
+ self.newfiles = set()
31
+ else:
32
+ self.newfiles = files
33
+
34
+ # assume that the fileset is open at first
35
+ self.open = True
36
+
37
+ # assume that the lastUpdate of fileset is 0 at first
38
+ self.lastUpdate = 0
39
+
40
+ def setLastUpdate(self, timeUpdate):
41
+ """
42
+ _setLastUpdate_
43
+
44
+ Change the last update time of this fileset. The lastUpdate parameter is a int
45
+ representing the last time where the fileset was modifed.
46
+ """
47
+ self.lastUpdate = timeUpdate
48
+
49
+ def addFile(self, file):
50
+ """
51
+ Add a (set of) file(s) to the fileset
52
+ If the file is already in self.files update that entry
53
+ e.g. to handle updated location
54
+ If the file is already in self.newfiles update that entry
55
+ e.g. to handle updated location
56
+ Else add the file to self.newfiles
57
+ """
58
+ file = self.makeset(file)
59
+ new = file - self.getFiles(type='set')
60
+ self.newfiles = self.makeset(self.newfiles) | new
61
+
62
+ updated = self.makeset(file) & self.getFiles(type='set')
63
+ "updated contains the original location information for updated files"
64
+
65
+ self.files = self.files.union(updated)
66
+
67
+ def getFiles(self, type='list'):
68
+ if type == 'list':
69
+ """
70
+ List all files in the fileset - returns a set of file objects
71
+ sorted by lfn.
72
+ """
73
+ files = list(self.getFiles(type='set'))
74
+
75
+ try:
76
+ files.sort(key=itemgetter('lfn'))
77
+ except Exception as e:
78
+ print('Problem with listFiles for fileset:', self.name)
79
+ print(files.pop())
80
+ raise e
81
+ return files
82
+ elif type == 'set':
83
+ return self.makeset(self.files) | self.makeset(self.newfiles)
84
+ elif type == 'lfn':
85
+ """
86
+ All the lfn's for files in the filesets
87
+ """
88
+ def getLFN(file):
89
+ return file["lfn"]
90
+ files = list(map(getLFN, self.getFiles(type='list')))
91
+ return files
92
+ elif type == 'id':
93
+ """
94
+ All the id's for files in the filesets
95
+ """
96
+ def getID(file):
97
+ return file["id"]
98
+
99
+ files = list(map(getID, self.getFiles(type='list')))
100
+ return files
101
+
102
+ def listNewFiles(self):
103
+ """
104
+ List all files in the fileset that are new - e.g. not in the DB - returns a set
105
+ """
106
+ return self.newfiles
107
+
108
+ def commit(self):
109
+ """
110
+ Add contents of self.newfiles to self, empty self.newfiles
111
+ """
112
+ self.files = self.makeset(self.files) | self.makeset(self.newfiles)
113
+ self.newfiles = set()
114
+
115
+ def __len__(self):
116
+ return len(self.getFiles(type='set'))
117
+
118
+ def __iter__(self):
119
+ for file in self.getFiles():
120
+ yield file
121
+
122
+ def markOpen(self, isOpen):
123
+ """
124
+ _markOpen_
125
+
126
+ Change the open status of this fileset. The isOpen parameter is a bool
127
+ representing whether or not the fileset is open.
128
+ """
129
+ self.open = isOpen
130
+
131
+ def __str__(self):
132
+ """
133
+ __str__
134
+
135
+ Write out something useful
136
+ """
137
+
138
+ st = {'name': self.name, 'files': self.files}
139
+
140
+ return str(st)
@@ -0,0 +1,182 @@
1
+ #!/usr/bin/env python
2
+ """
3
+ _Job_
4
+
5
+ Data object that describes a job
6
+
7
+ """
8
+
9
+ from builtins import map, range
10
+
11
+ __all__ = []
12
+
13
+
14
+ from WMCore.DataStructs.Mask import Mask
15
+ from WMCore.DataStructs.WMObject import WMObject
16
+ from WMCore.Configuration import ConfigSection
17
+
18
+ import time
19
+
20
+
21
+ class Job(WMObject, dict):
22
+ def __init__(self, name = None, files = None):
23
+ """
24
+ A job has a jobgroup which gives it its subscription and workflow.
25
+ inputFiles is a list containing files associated to a job
26
+ last_update is the time the job last changed
27
+ """
28
+ dict.__init__(self)
29
+ self.baggage = ConfigSection("baggage")
30
+ if files == None:
31
+ self["input_files"] = []
32
+ else:
33
+ self["input_files"] = files
34
+
35
+ self["id"] = None
36
+ self["jobgroup"] = None
37
+ self["name"] = name
38
+ self["state"] = 'new'
39
+ self["state_time"] = int(time.time())
40
+ self["outcome"] = "failure"
41
+ self["retry_count"] = 0
42
+ self["location"] = None
43
+ self["mask"] = Mask()
44
+ self["task"] = None
45
+ self["fwjr"] = None
46
+ self["fwjr_path"] = None
47
+ self["workflow"] = None
48
+ self["owner"] = None
49
+ self["estimatedJobTime"] = None
50
+ self["estimatedMemoryUsage"] = None
51
+ self["estimatedDiskUsage"] = None
52
+ return
53
+
54
+ # //
55
+ # // Use property to define getter/setter API for task
56
+ #// makes job.task and job.tast = "value" possible
57
+ task = property(lambda self: self['task'],
58
+ lambda self, x: self.__setitem__('task',x))
59
+
60
+ def save(self):
61
+ """
62
+ _save_
63
+
64
+ Bogus method to make this look more like the WMBS JOB.
65
+ """
66
+ return
67
+
68
+ def getFiles(self, type = "list"):
69
+ """
70
+ _getFiles_
71
+
72
+ Retrieve information about the input files for the job. The type
73
+ parameter can be set to one of the following:
74
+ list - A list of File objects will be returned
75
+ set - A set of File objects will be returned
76
+ lfn - A list of LFNs will be returned
77
+ id - A list if File IDs will be returned
78
+ """
79
+ if type == "list":
80
+ return self["input_files"]
81
+ elif type == "set":
82
+ return self.makeset(self["input_files"])
83
+ elif type == "lfn":
84
+ def getLFN(file):
85
+ return file["lfn"]
86
+
87
+ lfns = list(map(getLFN, self["input_files"]))
88
+ return lfns
89
+ elif type == "id":
90
+ def getID(file):
91
+ return file["id"]
92
+
93
+ ids = list(map(getID, self["input_files"]))
94
+ return ids
95
+
96
+ def addFile(self, file):
97
+ """
98
+ _addFile_
99
+
100
+ Add a file or list of files to the job's input.
101
+ """
102
+ if isinstance(file, list):
103
+ self["input_files"].extend(file)
104
+ else:
105
+ self["input_files"].append(file)
106
+
107
+ return
108
+
109
+ def changeState(self, newState):
110
+ """
111
+ _changeState_
112
+
113
+ Change the state of the job.
114
+ """
115
+ self["state"] = newState
116
+ self["state_time"] = int(time.time())
117
+
118
+ return
119
+
120
+ def changeOutcome(self, jobOutcome):
121
+ """
122
+ _changeOutcome_
123
+
124
+ Change the final outcome of the job, can be either success or fail.
125
+ """
126
+ self["outcome"] = jobOutcome
127
+ return
128
+
129
+ def addResourceEstimates(self, jobTime = None, memory = None, disk = None):
130
+ """
131
+ _addResourceEstimates_
132
+
133
+ Add to the current resource estimates, if None then initialize them
134
+ to the given value. Each value can be set independently.
135
+ """
136
+ if not self["estimatedJobTime"]:
137
+ self["estimatedJobTime"] = jobTime
138
+ elif jobTime:
139
+ self["estimatedJobTime"] += jobTime
140
+
141
+ if not self["estimatedMemoryUsage"]:
142
+ self["estimatedMemoryUsage"] = memory
143
+ elif memory:
144
+ self["estimatedMemoryUsage"] += memory
145
+
146
+ if not self["estimatedDiskUsage"]:
147
+ self["estimatedDiskUsage"] = disk
148
+ elif disk:
149
+ self["estimatedDiskUsage"] += disk
150
+
151
+ return
152
+
153
+ def getBaggage(self):
154
+ """
155
+ _getBaggage_
156
+
157
+ Get a reference to the embedded ConfigSection that is
158
+ used to store per job arguments needed to be propagated at
159
+ submission time
160
+
161
+ """
162
+ return self.baggage
163
+
164
+
165
+ def addBaggageParameter(self, attrName, value):
166
+ """
167
+ _addBaggageParameter_
168
+
169
+ Add an attribute as process.pset1.pset2.param = value
170
+ Value should be the appropriate python type
171
+
172
+ """
173
+ currentPSet = self.baggage
174
+ paramList = attrName.split(".")
175
+ for i in range(0, len(paramList)):
176
+ param = paramList.pop(0)
177
+ if len(paramList) > 0:
178
+ if not hasattr(currentPSet, param):
179
+ currentPSet.section_(param)
180
+ currentPSet = getattr(currentPSet, param)
181
+ else:
182
+ setattr(currentPSet, param, value)
@@ -0,0 +1,142 @@
1
+ #!/usr/bin/env python
2
+ """
3
+ _JobGroup_
4
+
5
+ Definition of JobGroup:
6
+ Set of jobs running on same input file for same Workflow
7
+ Set of jobs for a single subscription
8
+ Required for certain job splitting Algo's (.g. event split to make complete
9
+ lumi)
10
+ Subscription:JobGroup == 1:N
11
+ JobGroup:Jobs = 1:N
12
+ JobGroup:InFile = 1:1
13
+ JobGroup:MergedOutFile = N:1
14
+ JobGroup at least one Lumi section
15
+
16
+ A JobGroup is a set of jobs and a Fileset that contains their output.
17
+
18
+ JobGroup knows the Subscription and passes the Workflow to Jobs in the group.
19
+
20
+ Jobs know their status (active, failed, complete) and know the files they run
21
+ on but don't know the group. They do know their subscription and corresponding
22
+ workflow. This means Jobs can update their state in the database without
23
+ talking to the group, and WMBS JobGroups can calculate status from the database
24
+ instead of the in memory objects.
25
+
26
+ The group has a status call which goes through the jobs and updates the db for
27
+ state changes and then returns the status of the group (active, failed,
28
+ complete).
29
+
30
+ WMAgent deals with groups and calls group.status periodically
31
+ """
32
+ from __future__ import print_function
33
+
34
+ import datetime
35
+
36
+ from WMCore.DataStructs.Fileset import Fileset
37
+ from WMCore.DataStructs.WMObject import WMObject
38
+
39
+
40
+ class JobGroup(WMObject):
41
+ """
42
+ JobGroups are sets of jobs running on files who's output needs to be merged
43
+ together.
44
+ """
45
+
46
+ def __init__(self, subscription=None, jobs=None):
47
+ self.jobs = []
48
+ self.newjobs = []
49
+ self.id = 0
50
+
51
+ if isinstance(jobs, list):
52
+ self.newjobs = jobs
53
+ elif jobs is not None:
54
+ self.newjobs = [jobs]
55
+
56
+ self.subscription = subscription
57
+ self.output = Fileset()
58
+ self.last_update = datetime.datetime.now()
59
+
60
+ def add(self, job):
61
+ """
62
+ _add_
63
+
64
+ Add a Job or list of jobs to the JobGroup.
65
+ """
66
+ jobList = self.makelist(job)
67
+ self.newjobs.extend(jobList)
68
+ return
69
+
70
+ def commit(self):
71
+ """
72
+ _commit_
73
+
74
+ Move any jobs in the newjobs dict to the job dict. Empty the newjobs
75
+ dict.
76
+ """
77
+ self.jobs.extend(self.newjobs)
78
+ self.newjobs = []
79
+
80
+ def commitBulk(self):
81
+ """
82
+ Dummy method for consistency with WMBS implementation
83
+ """
84
+ self.commit()
85
+
86
+ def addOutput(self, file):
87
+ """
88
+ _addOutput_
89
+
90
+ Add a File to the JobGroup's output fileset. The File is committed
91
+ to the Fileset immediately.
92
+ """
93
+ self.output.addFile(file)
94
+ self.output.commit()
95
+
96
+ def getJobs(self, type="list"):
97
+ """
98
+ _getJobs_
99
+
100
+ Retrieve all of the jobs in the JobGroup. The output will either be
101
+ returned as a list of Job objects (when type is "list") or a list of
102
+ Job IDs (when type is "id").
103
+ """
104
+ if type == "list":
105
+ return self.jobs
106
+ elif type == "id":
107
+ jobIDs = []
108
+
109
+ for job in self.jobs:
110
+ jobIDs.append(job["id"])
111
+
112
+ return jobIDs
113
+ else:
114
+ print("Unknown type: %s" % type)
115
+
116
+ return
117
+
118
+ def getOutput(self, type="list"):
119
+ """
120
+ _getOutput_
121
+
122
+ Retrieve all of the files that are in the JobGroup's output fileset.
123
+ Type can be one of the following: list, set, lfn, id.
124
+ """
125
+ return self.output.getFiles(type=type)
126
+
127
+ def getLength(self, obj):
128
+ """
129
+ This just gets a length for either dict or list objects
130
+ """
131
+ if isinstance(obj, (dict, list)):
132
+ return len(obj)
133
+ else:
134
+ return 0
135
+
136
+ def __len__(self):
137
+ """
138
+ Allows use of len() on JobGroup
139
+ """
140
+ return self.getLength(self.jobs) + self.getLength(self.newjobs)
141
+
142
+ # return len(self.jobs.keys()) + len(self.newjobs.keys())
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env python
2
+ """
3
+ _JobPackage_
4
+
5
+ Data structure for storing and retreiving multiple job objects.
6
+ """
7
+ import pickle
8
+ from Utils.PythonVersion import HIGHEST_PICKLE_PROTOCOL
9
+ from WMCore.DataStructs.WMObject import WMObject
10
+
11
+
12
+ class JobPackage(WMObject, dict):
13
+ """
14
+ _JobPackage_
15
+ """
16
+
17
+ def __init__(self, directory=None):
18
+ """
19
+ __init__
20
+
21
+ Allow you to set a directory where the
22
+ package will be stored.
23
+ This is then saved for use by the
24
+ JobSubmitter
25
+ """
26
+ dict.__init__(self)
27
+ self.setdefault('directory', directory)
28
+
29
+ def save(self, fileName):
30
+ """
31
+ _save_
32
+
33
+ Pickle this object and save it to disk.
34
+ """
35
+ with open(fileName, 'wb') as fileHandle:
36
+ pickle.dump(self, fileHandle, protocol=HIGHEST_PICKLE_PROTOCOL)
37
+ return
38
+
39
+ def load(self, fileName):
40
+ """
41
+ _load_
42
+
43
+ Load a pickled JobPackage object.
44
+ """
45
+ self.clear()
46
+ with open(fileName, 'rb') as fileHandle:
47
+ loadedJobPackage = pickle.load(fileHandle)
48
+ self.update(loadedJobPackage)
49
+ return