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,659 @@
1
+ #!/usr/bin/env python
2
+ # pylint: disable=C0321,C0103,W0622
3
+ # W0622: redefined-builtin
4
+ """
5
+ _Configuration_
6
+
7
+ Module dealing with Configuration file in python format
8
+
9
+
10
+ """
11
+
12
+ from builtins import object, int, str as newstr, bytes as newbytes
13
+
14
+ from future.utils import listvalues
15
+
16
+ import os
17
+ import traceback
18
+
19
+ from Utils.PythonVersion import PY3
20
+
21
+ import importlib
22
+
23
+ _SimpleTypes = [
24
+ bool,
25
+ float,
26
+ # basestring, # For py2/py3 compatibility, don't let futurize remove PY3 Remove when python 3 transition complete
27
+ newbytes,
28
+ newstr,
29
+ type(None),
30
+ int,
31
+ ]
32
+
33
+ _ComplexTypes = [
34
+ dict,
35
+ list,
36
+ tuple,
37
+ ]
38
+
39
+ _SupportedTypes = []
40
+ _SupportedTypes.extend(_SimpleTypes)
41
+ _SupportedTypes.extend(_ComplexTypes)
42
+
43
+
44
+ def formatAsString(value):
45
+ """
46
+ _format_
47
+
48
+ format a value as python
49
+ keep parameters simple, trust python...
50
+ """
51
+ if isinstance(value, str):
52
+ value = "\'%s\'" % value
53
+ return str(value)
54
+
55
+
56
+ def formatNative(value):
57
+ """
58
+ _formatNative_
59
+
60
+ Like the format function, but allowing passing of ints, floats, etc.
61
+ """
62
+
63
+ if isinstance(value, int):
64
+ return value
65
+ if isinstance(value, float):
66
+ return value
67
+ if isinstance(value, list):
68
+ return value
69
+ if isinstance(value, dict):
70
+ return dict
71
+ return formatAsString(value)
72
+
73
+
74
+ class ConfigSection(object):
75
+ # pylint: disable=protected-access
76
+ """
77
+ _ConfigSection_
78
+
79
+ Chunk of configuration information
80
+ """
81
+
82
+ def __init__(self, name=None):
83
+ object.__init__(self)
84
+ self._internal_documentation = ""
85
+ self._internal_name = name
86
+ self._internal_settings = set()
87
+ self._internal_docstrings = {}
88
+ self._internal_children = set()
89
+ self._internal_parent_ref = None
90
+ # The flag skipChecks controls weather each parameter added to the configuration
91
+ # should be a primitive or complex type that can be "jsonized"
92
+ # By default it is false, but ConfigurationEx instances set it to True
93
+ self._internal_skipChecks = False
94
+
95
+ def __eq__(self, other):
96
+ if isinstance(other, type(self)):
97
+ return (
98
+ (self._internal_documentation == other._internal_documentation) and
99
+ (self._internal_name == other._internal_name) and
100
+ (self._internal_settings == other._internal_settings) and
101
+ (self._internal_docstrings == other._internal_docstrings) and
102
+ (self._internal_children == other._internal_children) and
103
+ (self._internal_parent_ref == other._internal_parent_ref))
104
+ return id(self) == id(other)
105
+
106
+ def _complexTypeCheck(self, name, value):
107
+
108
+ if isinstance(value, tuple(_SimpleTypes)):
109
+ return
110
+ elif isinstance(value, tuple(_ComplexTypes)):
111
+ vallist = value
112
+ if isinstance(value, dict):
113
+ vallist = listvalues(value)
114
+ for val in vallist:
115
+ self._complexTypeCheck(name, val)
116
+ else:
117
+ msg = "Not supported type in sequence:"
118
+ msg += "%s\n" % type(value)
119
+ msg += "for name: %s and value: %s\n" % (name, value)
120
+ msg += "Added to WMAgent Configuration."
121
+ msg += "Use ConfigurationEx to skip checks on config params"
122
+ raise RuntimeError(msg)
123
+
124
+ def __setattr__(self, name, value):
125
+ if name.startswith("_internal_"):
126
+ # skip test for internal setting
127
+ object.__setattr__(self, name, value)
128
+ return
129
+
130
+ if isinstance(value, ConfigSection):
131
+ # child ConfigSection
132
+ self._internal_children.add(name)
133
+ self._internal_settings.add(name)
134
+ value._internal_parent_ref = self
135
+ object.__setattr__(self, name, value)
136
+ return
137
+
138
+ # FIXME: This needs to be fixed when we run with py3 env
139
+ # This is the best solution we can afford right now. We tried to use
140
+ # Utils.Utilities.encodeUnicodeToBytes but it misteriously caused
141
+ # https://github.com/dmwm/WMCore/issues/10381
142
+ if not PY3:
143
+ if isinstance(value, unicode):
144
+ value = str(value)
145
+
146
+ # for backward compatibility use getattr and sure to work if the
147
+ # _internal_skipChecks flag is not set
148
+ if not getattr(self, '_internal_skipChecks', False):
149
+ self._complexTypeCheck(name, value)
150
+
151
+ object.__setattr__(self, name, value)
152
+ self._internal_settings.add(name)
153
+ return
154
+
155
+ def __delattr__(self, name):
156
+ if name.startswith("_internal_"):
157
+ # skip test for internal setting
158
+ object.__delattr__(self, name)
159
+ return
160
+ else:
161
+ if name in self._internal_children:
162
+ self._internal_children.remove(name)
163
+ if name in self._internal_settings:
164
+ self._internal_settings.remove(name)
165
+ object.__delattr__(self, name)
166
+ return
167
+
168
+ def __iter__(self):
169
+ for attr in self._internal_settings:
170
+ yield getattr(self, attr)
171
+
172
+ def __add__(self, otherSection):
173
+ """
174
+ _addition operator_
175
+
176
+ Define addition for two config section objects
177
+
178
+ """
179
+ for setting in otherSection._internal_settings:
180
+ settingInstance = getattr(otherSection, setting)
181
+ if setting in self._internal_settings:
182
+ currentSetting = getattr(self, setting)
183
+ if not isinstance(currentSetting, type(settingInstance)) \
184
+ and currentSetting is not None and settingInstance is not None:
185
+ msg = "Trying to overwrite a setting with mismatched types"
186
+ msg += "%s.%s is not the same type as %s.%s" % (
187
+ self._internal_name, setting,
188
+ otherSection._internal_name, setting
189
+ )
190
+
191
+ raise TypeError(msg)
192
+ self.__setattr__(setting, settingInstance)
193
+ return self
194
+
195
+ def section_(self, sectionName):
196
+ """
197
+ _section_
198
+
199
+ Get a section by name, create it if not present,
200
+ returns a ConfigSection instance
201
+
202
+ """
203
+ if sectionName in self.__dict__:
204
+ return self.__dict__[sectionName]
205
+ newSection = ConfigSection(sectionName)
206
+ self.__setattr__(sectionName, newSection)
207
+ return object.__getattribute__(self, sectionName)
208
+
209
+ def pythonise_(self, **options):
210
+ """
211
+ convert self into list of python format strings
212
+
213
+ options available
214
+
215
+ document - if True will add document_ calls to the python
216
+ comment - if True will add docs as comments.
217
+
218
+ """
219
+ document = options.get('document', False)
220
+ comment = options.get('comment', False)
221
+ prefix = options.get('prefix', None)
222
+
223
+ if prefix is not None:
224
+ myName = "%s.%s" % (prefix, self._internal_name)
225
+ else:
226
+ myName = self._internal_name
227
+
228
+ result = []
229
+ if document:
230
+ result.append("%s.document_(\"\"\"%s\"\"\")" % (
231
+ myName,
232
+ self._internal_documentation)
233
+ )
234
+ if comment:
235
+ result.append("# %s: %s" % (
236
+ myName, self._internal_documentation.replace(
237
+ "\n", "\n# "),
238
+ ))
239
+ for attr in self._internal_settings:
240
+ if attr in self._internal_children:
241
+ result.append("%s.section_(\'%s\')" % (myName, attr))
242
+ result.extend(getattr(self, attr).pythonise_(
243
+ document=document, comment=comment, prefix=myName))
244
+ continue
245
+ if attr in self._internal_docstrings:
246
+ if comment:
247
+ result.append("# %s.%s: %s" % (
248
+ myName, attr,
249
+ self._internal_docstrings[attr].replace("\n", "\n# ")
250
+ ))
251
+ result.append("%s.%s = %s" % (
252
+ myName,
253
+ attr, formatAsString(getattr(self, attr))
254
+ ))
255
+
256
+ if attr in self._internal_docstrings:
257
+ if document:
258
+ result.append(
259
+ "%s.document_(\"\"\"%s\"\"\", \'%s\')" % (
260
+ myName,
261
+ self._internal_docstrings[attr], attr))
262
+ return result
263
+
264
+ def dictionary_(self):
265
+ """
266
+ _dictionary_
267
+
268
+ Create a dictionary representation of this object.
269
+
270
+ This method does not take into account possible ConfigSections
271
+ as attributes of self (i.e. sub-ConfigSections) as the
272
+ dictionary_whole_tree_() method does.
273
+ The reason for this method to stay is that WebTools.Root.py
274
+ depends on a few places to check itself like:
275
+ if isinstance(param_value, ConfigSection) ...
276
+
277
+ """
278
+ result = {}
279
+ for x in self._internal_settings:
280
+ result.__setitem__(x, getattr(self, x))
281
+ return result
282
+
283
+ def dictionary_whole_tree_(self):
284
+ """
285
+ Create a dictionary representation of this object.
286
+
287
+ ConfigSection.dictionary_() method needs to expand possible
288
+ items that are ConfigSection instances (those which appear
289
+ in the _internal_children set).
290
+ Also these sub-ConfigSections have to be made dictionaries
291
+ rather than putting e.g.
292
+ 'Task1': <WMCore.Configuration.ConfigSection object at 0x104ccb50>
293
+
294
+ """
295
+ result = {}
296
+ for x in self._internal_settings:
297
+ if x in self._internal_children:
298
+ v = getattr(self, x)
299
+ result[x] = v.dictionary_whole_tree_()
300
+ continue
301
+ result.__setitem__(x, getattr(self, x)) # the same as result[x] = value
302
+ return result
303
+
304
+ def document_(self, docstring, parameter=None):
305
+ """
306
+ _document_
307
+
308
+ Add docs/comments to parameters. If the parameter is None, then
309
+ the documentation is provided to the section itself.
310
+ This method will overwrite any existing documentation
311
+
312
+ """
313
+ if parameter is None:
314
+ self._internal_documentation = str(docstring)
315
+ return
316
+ self._internal_docstrings[parameter] = str(docstring)
317
+ return
318
+
319
+ def __str__(self):
320
+ """
321
+ string representation, dump to python format
322
+ """
323
+ result = ""
324
+ for pystring in self.pythonise_():
325
+ result += "%s\n" % pystring
326
+ return result
327
+
328
+ def documentedString_(self):
329
+ """
330
+ string representation, dump to python format
331
+ include docs as calls to document_
332
+ """
333
+ result = ""
334
+ for pystring in self.pythonise_(document=True):
335
+ result += "%s\n" % pystring
336
+ return result
337
+
338
+ def commentedString_(self):
339
+ """
340
+ string representation, dump to python format
341
+ include docs as comments
342
+ """
343
+ result = ""
344
+ for pystring in self.pythonise_(comment=True):
345
+ result += "%s\n" % pystring
346
+ return result
347
+
348
+ # Added by mnorman to make our strategy to use configSections viable
349
+ def listSections_(self):
350
+ """
351
+ _listSections_
352
+
353
+ Retrieve a list of components from the components
354
+ configuration section
355
+
356
+ """
357
+ comps = self._internal_settings
358
+ return list(comps)
359
+
360
+ def getInternalName(self):
361
+ """
362
+ _getInternalName_
363
+
364
+ Return the internal name
365
+
366
+ """
367
+ return self._internal_name
368
+
369
+
370
+ class Configuration(object):
371
+ # pylint: disable=protected-access
372
+ """
373
+ _Configuration_
374
+
375
+ Top level configuration object
376
+
377
+ """
378
+
379
+ def __init__(self):
380
+ object.__init__(self)
381
+ self._internal_components = []
382
+ self._internal_webapps = []
383
+ self._internal_sections = []
384
+ self._internal_loadPath = None
385
+ Configuration._instance = self
386
+
387
+ def __add__(self, otherConfig):
388
+ """
389
+ _addition operator_
390
+
391
+ Define addition for two config section objects
392
+
393
+ """
394
+ for configSect in otherConfig._internal_sections:
395
+ if configSect not in self._internal_sections:
396
+ self.section_(configSect)
397
+ getattr(self, configSect) + getattr(otherConfig, configSect)
398
+ return self
399
+
400
+ def __setattr__(self, name, value):
401
+ if name.startswith("_internal_"):
402
+ # skip test for internal settings
403
+ object.__setattr__(self, name, value)
404
+ return
405
+ if not isinstance(value, ConfigSection):
406
+ msg = "Can only add objects of type ConfigSection to Configuration"
407
+ raise RuntimeError(msg)
408
+
409
+ object.__setattr__(self, name, value)
410
+ return
411
+
412
+ def __delattr__(self, name):
413
+ if name.startswith("_internal_"):
414
+ # skip test for internal setting
415
+ object.__delattr__(self, name)
416
+ return
417
+ else:
418
+ if name in self._internal_sections:
419
+ self._internal_sections.remove(name)
420
+ if name in self._internal_components:
421
+ self._internal_components.remove(name)
422
+ if name in self._internal_webapps:
423
+ self._internal_webapps.remove(name)
424
+ object.__delattr__(self, name)
425
+ return
426
+
427
+ @staticmethod
428
+ def getInstance():
429
+ return getattr(Configuration, "_instance", None)
430
+
431
+ def _setLoadPath(self, loadPath):
432
+ self._internal_loadPath = loadPath
433
+
434
+ def getLoadPath(self):
435
+ return self._internal_loadPath
436
+
437
+ def listComponents_(self):
438
+ """
439
+ _listComponents_
440
+
441
+ Retrieve a list of components from the components
442
+ configuration section
443
+
444
+ """
445
+ comps = self._internal_components
446
+ return comps
447
+
448
+ def listWebapps_(self):
449
+ """
450
+ _listWebapps_
451
+
452
+ Retrieve a list of webapps from the webapps configuration section.
453
+ """
454
+ return self._internal_webapps
455
+
456
+ def listSections_(self):
457
+ """
458
+ _listSections_
459
+
460
+ Retrieve a list of components from the components
461
+ configuration section
462
+
463
+ """
464
+ comps = self._internal_sections
465
+ return comps
466
+
467
+ def section_(self, sectionName):
468
+ """
469
+ _section_
470
+
471
+ Get a section by name, create it if not present,
472
+ returns a ConfigSection instance
473
+
474
+ """
475
+ if sectionName in self.__dict__:
476
+ return self.__dict__[sectionName]
477
+ newSection = ConfigSection(sectionName)
478
+ self.__setattr__(sectionName, newSection)
479
+ self._internal_sections.append(sectionName)
480
+ return object.__getattribute__(self, sectionName)
481
+
482
+ def component_(self, componentName):
483
+ """
484
+ _component_
485
+
486
+ Get the config for the named component, add it
487
+ if not present, returns a ConfigSection with
488
+ default fields for the component added to it
489
+
490
+ """
491
+ compSection = self.section_(componentName)
492
+ if componentName not in self._internal_components:
493
+ self._internal_components.append(componentName)
494
+ compSection.componentDir = None
495
+
496
+ return compSection
497
+
498
+ def webapp_(self, webappName):
499
+ """
500
+ _webapp_
501
+
502
+ Get the config for the named webapp, add it if not present. This will
503
+ return a ConfigSection with default fields for the webapp added to it.
504
+ """
505
+ webappSection = self.section_(webappName)
506
+ if webappName not in self._internal_webapps:
507
+ self._internal_webapps.append(webappName)
508
+ webappSection.section_("Webtools")
509
+ webappSection.section_("database")
510
+ webappSection.section_("security")
511
+
512
+ return webappSection
513
+
514
+ def pythonise_(self, **options):
515
+ """
516
+ write as python format
517
+
518
+
519
+ document - if True will add document_ calls to the python
520
+ comment - if True will add docs as comments.
521
+
522
+ """
523
+ document = options.get('document', False)
524
+ comment = options.get('comment', False)
525
+
526
+ result = "from WMCore.Configuration import Configuration\n"
527
+ result += "config = Configuration()\n"
528
+ for sectionName in self._internal_sections:
529
+ if sectionName in self._internal_components:
530
+ result += "config.component_(\'%s\')\n" % sectionName
531
+ elif sectionName in self._internal_webapps:
532
+ result += "config.webapp_(\'%s\')\n" % sectionName
533
+ else:
534
+ result += "config.section_(\'%s\')\n" % sectionName
535
+
536
+ sectionRef = getattr(self, sectionName)
537
+ for sectionAttr in sectionRef.pythonise_(
538
+ document=document, comment=comment):
539
+ if sectionAttr.startswith("#"):
540
+ result += "%s\n" % sectionAttr
541
+ else:
542
+ result += "config.%s\n" % sectionAttr
543
+
544
+ return result
545
+
546
+ def __str__(self):
547
+ """
548
+ string format of this object
549
+
550
+ """
551
+ return self.pythonise_()
552
+
553
+ def documentedString_(self):
554
+ """
555
+ python format with document_ calls
556
+ """
557
+ return self.pythonise_(document=True)
558
+
559
+ def commentedString_(self):
560
+ """
561
+ python format with docs as comments
562
+ """
563
+ return self.pythonise_(comment=True)
564
+
565
+
566
+ class ConfigurationEx(Configuration):
567
+ """
568
+ _Configuration_
569
+
570
+ Top level extended configuration object
571
+
572
+ Allows to freely set parameters of the configuration. Things like callables
573
+ can be used as configuration parameters now. Drawback is that the configuration
574
+ cannot be saved and passed around using the code.
575
+ """
576
+
577
+ def __init__(self):
578
+ # super(ConfigurationEx, self).__init__()
579
+ Configuration.__init__(self)
580
+
581
+ def section_(self, sectionName):
582
+ """
583
+ _section_
584
+
585
+ Get a section by name, create it if not present,
586
+ and set the skipChecks flag
587
+ returns a ConfigSection instance
588
+
589
+ """
590
+ section = Configuration.section_(self, sectionName)
591
+ section._internal_skipChecks = True # pylint: disable=protected-access
592
+ return section
593
+
594
+
595
+ def loadConfigurationFile(filename):
596
+ """
597
+ _loadConfigurationFile_
598
+
599
+ Load a Configuration File
600
+
601
+ """
602
+
603
+ cfgBaseName = os.path.basename(filename).replace(".py", "")
604
+ cfgDirName = os.path.dirname(filename)
605
+ if not cfgDirName:
606
+ modSpecs = importlib.machinery.PathFinder().find_spec(cfgBaseName)
607
+ else:
608
+ modSpecs = importlib.machinery.PathFinder().find_spec(cfgBaseName, [cfgDirName])
609
+ try:
610
+ modRef = modSpecs.loader.load_module()
611
+ except Exception as ex:
612
+ msg = "Unable to load Configuration File:\n"
613
+ msg += "%s\n" % filename
614
+ msg += "Due to error:\n"
615
+ msg += str(ex)
616
+ msg += str(traceback.format_exc())
617
+ raise RuntimeError(msg)
618
+
619
+ for attr in listvalues(modRef.__dict__):
620
+ if isinstance(attr, Configuration):
621
+ attr._setLoadPath(modSpecs.loader.path)
622
+ return attr
623
+
624
+ # //
625
+ # // couldnt find a Configuration instance
626
+ # //
627
+ msg = "Unable to find a Configuration object instance in file:\n"
628
+ msg += "%s\n" % filename
629
+ raise RuntimeError(msg)
630
+
631
+
632
+ def saveConfigurationFile(configInstance, filename, **options):
633
+ """
634
+ _saveConfigurationFile_
635
+
636
+ Save the configuration as a python module
637
+ Options controls the format of documentation
638
+
639
+ comment = True means save docs as comments
640
+ document = True means save docs as document_ calls
641
+
642
+
643
+ """
644
+ if isinstance(configInstance, ConfigurationEx):
645
+ raise NotImplementedError("ConfigurationEx instances cannot be saved. Use Configuration instead.")
646
+ comment = options.get("comment", False)
647
+ document = options.get("document", False)
648
+ if document:
649
+ comment = False
650
+
651
+ with open(filename, 'w') as handle:
652
+ if document:
653
+ handle.write(configInstance.documentedString_())
654
+ elif comment:
655
+ handle.write(configInstance.commentedString_())
656
+ else:
657
+ handle.write(str(configInstance))
658
+
659
+ return
WMCore/DAOFactory.py ADDED
@@ -0,0 +1,47 @@
1
+ """
2
+ A basic action is a thing that will run a SQL statement
3
+
4
+ A more complex one would be something that ran multiple SQL
5
+ objects to produce a single output.
6
+ """
7
+
8
+ from builtins import object
9
+
10
+ class DAOFactory(object):
11
+ def __init__(self, package='WMCore', logger=None, dbinterface=None, owner=""):
12
+ self.package = package
13
+ self.logger = logger
14
+ self.dbinterface = dbinterface
15
+ self.owner = owner
16
+ #self.logger.debug("Instantiating DAOFactory for %s package" % self.package)
17
+ from WMCore.Database.Dialects import MySQLDialect
18
+ from WMCore.Database.Dialects import OracleDialect
19
+ self.dialects = {"Oracle" : OracleDialect,
20
+ "MySQL" : MySQLDialect,}
21
+
22
+ def __call__(self, classname):
23
+ """
24
+ Somewhat fugly method to load generic SQL classes...
25
+ """
26
+ if not isinstance(self.dbinterface, str):
27
+
28
+ dia = self.dbinterface.engine.dialect
29
+ #TODO: Make good
30
+ dialect = None
31
+ for i in self.dialects:
32
+ if isinstance(dia, self.dialects[i]):
33
+ dialect = i
34
+ if not dialect:
35
+ raise TypeError("unknown connection type: %s" % dia)
36
+ else:
37
+ dialect = 'CouchDB'
38
+
39
+
40
+ module = "%s.%s.%s" % (self.package, dialect, classname)
41
+ #self.logger.debug("importing %s, %s" % (module, classname))
42
+ module = __import__(module, globals(), locals(), [classname])#, -1)
43
+ instance = getattr(module, classname.split('.')[-1])
44
+ if self.owner:
45
+ return instance(self.logger, self.dbinterface, self.owner)
46
+ else:
47
+ return instance(self.logger, self.dbinterface)