wmglobalqueue 2.3.10__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.
Potentially problematic release.
This version of wmglobalqueue might be problematic. Click here for more details.
- Utils/CPMetrics.py +270 -0
- Utils/CertTools.py +62 -0
- Utils/EmailAlert.py +50 -0
- Utils/ExtendedUnitTestCase.py +62 -0
- Utils/FileTools.py +182 -0
- Utils/IteratorTools.py +80 -0
- Utils/MathUtils.py +31 -0
- Utils/MemoryCache.py +119 -0
- Utils/Patterns.py +24 -0
- Utils/Pipeline.py +137 -0
- Utils/PortForward.py +97 -0
- Utils/ProcessStats.py +103 -0
- Utils/PythonVersion.py +17 -0
- Utils/Signals.py +36 -0
- Utils/TemporaryEnvironment.py +27 -0
- Utils/Throttled.py +227 -0
- Utils/Timers.py +130 -0
- Utils/Timestamps.py +86 -0
- Utils/TokenManager.py +143 -0
- Utils/Tracing.py +60 -0
- Utils/TwPrint.py +98 -0
- Utils/Utilities.py +308 -0
- Utils/__init__.py +11 -0
- WMCore/ACDC/Collection.py +57 -0
- WMCore/ACDC/CollectionTypes.py +12 -0
- WMCore/ACDC/CouchCollection.py +67 -0
- WMCore/ACDC/CouchFileset.py +238 -0
- WMCore/ACDC/CouchService.py +73 -0
- WMCore/ACDC/DataCollectionService.py +485 -0
- WMCore/ACDC/Fileset.py +94 -0
- WMCore/ACDC/__init__.py +11 -0
- WMCore/Algorithms/Alarm.py +39 -0
- WMCore/Algorithms/MathAlgos.py +274 -0
- WMCore/Algorithms/MiscAlgos.py +67 -0
- WMCore/Algorithms/ParseXMLFile.py +115 -0
- WMCore/Algorithms/Permissions.py +27 -0
- WMCore/Algorithms/Singleton.py +58 -0
- WMCore/Algorithms/SubprocessAlgos.py +129 -0
- WMCore/Algorithms/__init__.py +7 -0
- WMCore/Cache/GenericDataCache.py +98 -0
- WMCore/Cache/WMConfigCache.py +572 -0
- WMCore/Cache/__init__.py +0 -0
- WMCore/Configuration.py +651 -0
- WMCore/DAOFactory.py +47 -0
- WMCore/DataStructs/File.py +177 -0
- WMCore/DataStructs/Fileset.py +140 -0
- WMCore/DataStructs/Job.py +182 -0
- WMCore/DataStructs/JobGroup.py +142 -0
- WMCore/DataStructs/JobPackage.py +49 -0
- WMCore/DataStructs/LumiList.py +734 -0
- WMCore/DataStructs/Mask.py +219 -0
- WMCore/DataStructs/MathStructs/ContinuousSummaryHistogram.py +197 -0
- WMCore/DataStructs/MathStructs/DiscreteSummaryHistogram.py +92 -0
- WMCore/DataStructs/MathStructs/SummaryHistogram.py +117 -0
- WMCore/DataStructs/MathStructs/__init__.py +0 -0
- WMCore/DataStructs/Pickleable.py +24 -0
- WMCore/DataStructs/Run.py +256 -0
- WMCore/DataStructs/Subscription.py +175 -0
- WMCore/DataStructs/WMObject.py +47 -0
- WMCore/DataStructs/WorkUnit.py +112 -0
- WMCore/DataStructs/Workflow.py +60 -0
- WMCore/DataStructs/__init__.py +8 -0
- WMCore/Database/CMSCouch.py +1349 -0
- WMCore/Database/ConfigDBMap.py +29 -0
- WMCore/Database/CouchUtils.py +118 -0
- WMCore/Database/DBCore.py +198 -0
- WMCore/Database/DBCreator.py +113 -0
- WMCore/Database/DBExceptionHandler.py +57 -0
- WMCore/Database/DBFactory.py +110 -0
- WMCore/Database/DBFormatter.py +177 -0
- WMCore/Database/Dialects.py +13 -0
- WMCore/Database/ExecuteDAO.py +327 -0
- WMCore/Database/MongoDB.py +241 -0
- WMCore/Database/MySQL/Destroy.py +42 -0
- WMCore/Database/MySQL/ListUserContent.py +20 -0
- WMCore/Database/MySQL/__init__.py +9 -0
- WMCore/Database/MySQLCore.py +132 -0
- WMCore/Database/Oracle/Destroy.py +56 -0
- WMCore/Database/Oracle/ListUserContent.py +19 -0
- WMCore/Database/Oracle/__init__.py +9 -0
- WMCore/Database/ResultSet.py +44 -0
- WMCore/Database/Transaction.py +91 -0
- WMCore/Database/__init__.py +9 -0
- WMCore/Database/ipy_profile_couch.py +438 -0
- WMCore/GlobalWorkQueue/CherryPyThreads/CleanUpTask.py +29 -0
- WMCore/GlobalWorkQueue/CherryPyThreads/HeartbeatMonitor.py +105 -0
- WMCore/GlobalWorkQueue/CherryPyThreads/LocationUpdateTask.py +28 -0
- WMCore/GlobalWorkQueue/CherryPyThreads/ReqMgrInteractionTask.py +35 -0
- WMCore/GlobalWorkQueue/CherryPyThreads/__init__.py +0 -0
- WMCore/GlobalWorkQueue/__init__.py +0 -0
- WMCore/GroupUser/CouchObject.py +127 -0
- WMCore/GroupUser/Decorators.py +51 -0
- WMCore/GroupUser/Group.py +33 -0
- WMCore/GroupUser/Interface.py +73 -0
- WMCore/GroupUser/User.py +96 -0
- WMCore/GroupUser/__init__.py +11 -0
- WMCore/Lexicon.py +836 -0
- WMCore/REST/Auth.py +202 -0
- WMCore/REST/CherryPyPeriodicTask.py +166 -0
- WMCore/REST/Error.py +333 -0
- WMCore/REST/Format.py +642 -0
- WMCore/REST/HeartbeatMonitorBase.py +90 -0
- WMCore/REST/Main.py +623 -0
- WMCore/REST/Server.py +2435 -0
- WMCore/REST/Services.py +24 -0
- WMCore/REST/Test.py +120 -0
- WMCore/REST/Tools.py +38 -0
- WMCore/REST/Validation.py +250 -0
- WMCore/REST/__init__.py +1 -0
- WMCore/ReqMgr/DataStructs/RequestStatus.py +209 -0
- WMCore/ReqMgr/DataStructs/RequestType.py +13 -0
- WMCore/ReqMgr/DataStructs/__init__.py +0 -0
- WMCore/ReqMgr/__init__.py +1 -0
- WMCore/Services/AlertManager/AlertManagerAPI.py +111 -0
- WMCore/Services/AlertManager/__init__.py +0 -0
- WMCore/Services/CRIC/CRIC.py +238 -0
- WMCore/Services/CRIC/__init__.py +0 -0
- WMCore/Services/DBS/DBS3Reader.py +1044 -0
- WMCore/Services/DBS/DBSConcurrency.py +44 -0
- WMCore/Services/DBS/DBSErrors.py +113 -0
- WMCore/Services/DBS/DBSReader.py +23 -0
- WMCore/Services/DBS/DBSUtils.py +139 -0
- WMCore/Services/DBS/DBSWriterObjects.py +381 -0
- WMCore/Services/DBS/ProdException.py +133 -0
- WMCore/Services/DBS/__init__.py +8 -0
- WMCore/Services/FWJRDB/FWJRDBAPI.py +118 -0
- WMCore/Services/FWJRDB/__init__.py +0 -0
- WMCore/Services/HTTPS/HTTPSAuthHandler.py +66 -0
- WMCore/Services/HTTPS/__init__.py +0 -0
- WMCore/Services/LogDB/LogDB.py +201 -0
- WMCore/Services/LogDB/LogDBBackend.py +191 -0
- WMCore/Services/LogDB/LogDBExceptions.py +11 -0
- WMCore/Services/LogDB/LogDBReport.py +85 -0
- WMCore/Services/LogDB/__init__.py +0 -0
- WMCore/Services/MSPileup/__init__.py +0 -0
- WMCore/Services/MSUtils/MSUtils.py +54 -0
- WMCore/Services/MSUtils/__init__.py +0 -0
- WMCore/Services/McM/McM.py +173 -0
- WMCore/Services/McM/__init__.py +8 -0
- WMCore/Services/MonIT/Grafana.py +133 -0
- WMCore/Services/MonIT/__init__.py +0 -0
- WMCore/Services/PyCondor/PyCondorAPI.py +154 -0
- WMCore/Services/PyCondor/PyCondorUtils.py +105 -0
- WMCore/Services/PyCondor/__init__.py +0 -0
- WMCore/Services/ReqMgr/ReqMgr.py +261 -0
- WMCore/Services/ReqMgr/__init__.py +0 -0
- WMCore/Services/ReqMgrAux/ReqMgrAux.py +419 -0
- WMCore/Services/ReqMgrAux/__init__.py +0 -0
- WMCore/Services/RequestDB/RequestDBReader.py +267 -0
- WMCore/Services/RequestDB/RequestDBWriter.py +39 -0
- WMCore/Services/RequestDB/__init__.py +0 -0
- WMCore/Services/Requests.py +624 -0
- WMCore/Services/Rucio/Rucio.py +1287 -0
- WMCore/Services/Rucio/RucioUtils.py +74 -0
- WMCore/Services/Rucio/__init__.py +0 -0
- WMCore/Services/RucioConMon/RucioConMon.py +128 -0
- WMCore/Services/RucioConMon/__init__.py +0 -0
- WMCore/Services/Service.py +400 -0
- WMCore/Services/StompAMQ/__init__.py +0 -0
- WMCore/Services/TagCollector/TagCollector.py +155 -0
- WMCore/Services/TagCollector/XMLUtils.py +98 -0
- WMCore/Services/TagCollector/__init__.py +0 -0
- WMCore/Services/UUIDLib.py +13 -0
- WMCore/Services/UserFileCache/UserFileCache.py +160 -0
- WMCore/Services/UserFileCache/__init__.py +8 -0
- WMCore/Services/WMAgent/WMAgent.py +63 -0
- WMCore/Services/WMAgent/__init__.py +0 -0
- WMCore/Services/WMArchive/CMSSWMetrics.py +526 -0
- WMCore/Services/WMArchive/DataMap.py +463 -0
- WMCore/Services/WMArchive/WMArchive.py +33 -0
- WMCore/Services/WMArchive/__init__.py +0 -0
- WMCore/Services/WMBS/WMBS.py +97 -0
- WMCore/Services/WMBS/__init__.py +0 -0
- WMCore/Services/WMStats/DataStruct/RequestInfoCollection.py +300 -0
- WMCore/Services/WMStats/DataStruct/__init__.py +0 -0
- WMCore/Services/WMStats/WMStatsPycurl.py +145 -0
- WMCore/Services/WMStats/WMStatsReader.py +445 -0
- WMCore/Services/WMStats/WMStatsWriter.py +273 -0
- WMCore/Services/WMStats/__init__.py +0 -0
- WMCore/Services/WMStatsServer/WMStatsServer.py +134 -0
- WMCore/Services/WMStatsServer/__init__.py +0 -0
- WMCore/Services/WorkQueue/WorkQueue.py +492 -0
- WMCore/Services/WorkQueue/__init__.py +0 -0
- WMCore/Services/__init__.py +8 -0
- WMCore/Services/pycurl_manager.py +574 -0
- WMCore/WMBase.py +50 -0
- WMCore/WMConnectionBase.py +164 -0
- WMCore/WMException.py +183 -0
- WMCore/WMExceptions.py +269 -0
- WMCore/WMFactory.py +76 -0
- WMCore/WMInit.py +228 -0
- WMCore/WMLogging.py +108 -0
- WMCore/WMSpec/ConfigSectionTree.py +442 -0
- WMCore/WMSpec/Persistency.py +135 -0
- WMCore/WMSpec/Steps/BuildMaster.py +87 -0
- WMCore/WMSpec/Steps/BuildTools.py +201 -0
- WMCore/WMSpec/Steps/Builder.py +97 -0
- WMCore/WMSpec/Steps/Diagnostic.py +89 -0
- WMCore/WMSpec/Steps/Emulator.py +62 -0
- WMCore/WMSpec/Steps/ExecuteMaster.py +208 -0
- WMCore/WMSpec/Steps/Executor.py +210 -0
- WMCore/WMSpec/Steps/StepFactory.py +213 -0
- WMCore/WMSpec/Steps/TaskEmulator.py +75 -0
- WMCore/WMSpec/Steps/Template.py +204 -0
- WMCore/WMSpec/Steps/Templates/AlcaHarvest.py +76 -0
- WMCore/WMSpec/Steps/Templates/CMSSW.py +613 -0
- WMCore/WMSpec/Steps/Templates/DQMUpload.py +59 -0
- WMCore/WMSpec/Steps/Templates/DeleteFiles.py +70 -0
- WMCore/WMSpec/Steps/Templates/LogArchive.py +84 -0
- WMCore/WMSpec/Steps/Templates/LogCollect.py +105 -0
- WMCore/WMSpec/Steps/Templates/StageOut.py +105 -0
- WMCore/WMSpec/Steps/Templates/__init__.py +10 -0
- WMCore/WMSpec/Steps/WMExecutionFailure.py +21 -0
- WMCore/WMSpec/Steps/__init__.py +8 -0
- WMCore/WMSpec/Utilities.py +63 -0
- WMCore/WMSpec/WMSpecErrors.py +12 -0
- WMCore/WMSpec/WMStep.py +347 -0
- WMCore/WMSpec/WMTask.py +1980 -0
- WMCore/WMSpec/WMWorkload.py +2288 -0
- WMCore/WMSpec/WMWorkloadTools.py +370 -0
- WMCore/WMSpec/__init__.py +9 -0
- WMCore/WorkQueue/DataLocationMapper.py +273 -0
- WMCore/WorkQueue/DataStructs/ACDCBlock.py +47 -0
- WMCore/WorkQueue/DataStructs/Block.py +48 -0
- WMCore/WorkQueue/DataStructs/CouchWorkQueueElement.py +148 -0
- WMCore/WorkQueue/DataStructs/WorkQueueElement.py +274 -0
- WMCore/WorkQueue/DataStructs/WorkQueueElementResult.py +152 -0
- WMCore/WorkQueue/DataStructs/WorkQueueElementsSummary.py +185 -0
- WMCore/WorkQueue/DataStructs/__init__.py +0 -0
- WMCore/WorkQueue/Policy/End/EndPolicyInterface.py +44 -0
- WMCore/WorkQueue/Policy/End/SingleShot.py +22 -0
- WMCore/WorkQueue/Policy/End/__init__.py +32 -0
- WMCore/WorkQueue/Policy/PolicyInterface.py +17 -0
- WMCore/WorkQueue/Policy/Start/Block.py +258 -0
- WMCore/WorkQueue/Policy/Start/Dataset.py +180 -0
- WMCore/WorkQueue/Policy/Start/MonteCarlo.py +131 -0
- WMCore/WorkQueue/Policy/Start/ResubmitBlock.py +171 -0
- WMCore/WorkQueue/Policy/Start/StartPolicyInterface.py +316 -0
- WMCore/WorkQueue/Policy/Start/__init__.py +34 -0
- WMCore/WorkQueue/Policy/__init__.py +57 -0
- WMCore/WorkQueue/WMBSHelper.py +772 -0
- WMCore/WorkQueue/WorkQueue.py +1237 -0
- WMCore/WorkQueue/WorkQueueBackend.py +750 -0
- WMCore/WorkQueue/WorkQueueBase.py +39 -0
- WMCore/WorkQueue/WorkQueueExceptions.py +44 -0
- WMCore/WorkQueue/WorkQueueReqMgrInterface.py +278 -0
- WMCore/WorkQueue/WorkQueueUtils.py +130 -0
- WMCore/WorkQueue/__init__.py +13 -0
- WMCore/Wrappers/JsonWrapper/JSONThunker.py +342 -0
- WMCore/Wrappers/JsonWrapper/__init__.py +7 -0
- WMCore/Wrappers/__init__.py +6 -0
- WMCore/__init__.py +10 -0
- wmglobalqueue-2.3.10.data/data/bin/wmc-dist-patch +15 -0
- wmglobalqueue-2.3.10.data/data/bin/wmc-dist-unpatch +8 -0
- wmglobalqueue-2.3.10.data/data/bin/wmc-httpd +3 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/.couchapprc +1 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/README.md +40 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/_attachments/index.html +264 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/_attachments/js/ElementInfoByWorkflow.js +96 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/_attachments/js/StuckElementInfo.js +57 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/_attachments/js/WorkloadInfoTable.js +80 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/_attachments/js/dataTable.js +70 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/_attachments/js/namespace.js +23 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/_attachments/style/main.css +75 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/couchapp.json +4 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/filters/childQueueFilter.js +13 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/filters/filterDeletedDocs.js +3 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/filters/queueFilter.js +11 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/language +1 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/lib/mustache.js +333 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/lib/validate.js +27 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/lib/workqueue_utils.js +61 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/lists/elementsDetail.js +28 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/lists/filter.js +86 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/lists/stuckElements.js +38 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/lists/workRestrictions.js +153 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/lists/workflowSummary.js +28 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/rewrites.json +73 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/shows/redirect.js +23 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/shows/status.js +40 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/templates/ElementSummaryByWorkflow.html +27 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/templates/StuckElementSummary.html +26 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/templates/TaskStatus.html +23 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/templates/WorkflowSummary.html +27 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/templates/partials/workqueue-common-lib.html +2 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/templates/partials/yui-lib-remote.html +16 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/templates/partials/yui-lib.html +18 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/updates/in-place.js +50 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/validate_doc_update.js +8 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/vendor/couchapp/_attachments/jquery.couch.app.js +235 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/vendor/couchapp/_attachments/jquery.pathbinder.js +173 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/activeData/map.js +8 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/activeData/reduce.js +2 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/activeParentData/map.js +8 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/activeParentData/reduce.js +2 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/activePileupData/map.js +8 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/activePileupData/reduce.js +2 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/analyticsData/map.js +11 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/analyticsData/reduce.js +1 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/availableByPriority/map.js +6 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/conflicts/map.js +5 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/elements/map.js +5 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/elementsByData/map.js +8 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/elementsByParent/map.js +8 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/elementsByParentData/map.js +8 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/elementsByPileupData/map.js +8 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/elementsByStatus/map.js +8 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/elementsBySubscription/map.js +6 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/elementsByWorkflow/map.js +8 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/elementsByWorkflow/reduce.js +3 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/elementsDetailByWorkflowAndStatus/map.js +26 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/jobInjectStatusByRequest/map.js +10 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/jobInjectStatusByRequest/reduce.js +1 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/jobStatusByRequest/map.js +6 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/jobStatusByRequest/reduce.js +1 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/jobsByChildQueueAndPriority/map.js +6 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/jobsByChildQueueAndPriority/reduce.js +1 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/jobsByChildQueueAndStatus/map.js +6 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/jobsByChildQueueAndStatus/reduce.js +1 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/jobsByRequest/map.js +6 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/jobsByRequest/reduce.js +1 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/jobsByStatus/map.js +6 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/jobsByStatus/reduce.js +1 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/jobsByStatusAndPriority/map.js +6 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/jobsByStatusAndPriority/reduce.js +1 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/openRequests/map.js +6 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/recent-items/map.js +5 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/siteWhitelistByRequest/map.js +6 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/siteWhitelistByRequest/reduce.js +1 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/specsByWorkflow/map.js +5 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/stuckElements/map.js +38 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/wmbsInjectStatusByRequest/map.js +12 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/wmbsInjectStatusByRequest/reduce.js +3 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/wmbsUrl/map.js +6 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/wmbsUrl/reduce.js +2 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/wmbsUrlByRequest/map.js +6 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/wmbsUrlByRequest/reduce.js +2 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/workflowSummary/map.js +9 -0
- wmglobalqueue-2.3.10.data/data/data/couchapps/WorkQueue/views/workflowSummary/reduce.js +10 -0
- wmglobalqueue-2.3.10.dist-info/LICENSE +202 -0
- wmglobalqueue-2.3.10.dist-info/METADATA +24 -0
- wmglobalqueue-2.3.10.dist-info/NOTICE +16 -0
- wmglobalqueue-2.3.10.dist-info/RECORD +345 -0
- wmglobalqueue-2.3.10.dist-info/WHEEL +5 -0
- wmglobalqueue-2.3.10.dist-info/top_level.txt +2 -0
WMCore/Configuration.py
ADDED
|
@@ -0,0 +1,651 @@
|
|
|
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
|
+
Configuration._instance = self
|
|
385
|
+
|
|
386
|
+
def __add__(self, otherConfig):
|
|
387
|
+
"""
|
|
388
|
+
_addition operator_
|
|
389
|
+
|
|
390
|
+
Define addition for two config section objects
|
|
391
|
+
|
|
392
|
+
"""
|
|
393
|
+
for configSect in otherConfig._internal_sections:
|
|
394
|
+
if configSect not in self._internal_sections:
|
|
395
|
+
self.section_(configSect)
|
|
396
|
+
getattr(self, configSect) + getattr(otherConfig, configSect)
|
|
397
|
+
return self
|
|
398
|
+
|
|
399
|
+
def __setattr__(self, name, value):
|
|
400
|
+
if name.startswith("_internal_"):
|
|
401
|
+
# skip test for internal settings
|
|
402
|
+
object.__setattr__(self, name, value)
|
|
403
|
+
return
|
|
404
|
+
if not isinstance(value, ConfigSection):
|
|
405
|
+
msg = "Can only add objects of type ConfigSection to Configuration"
|
|
406
|
+
raise RuntimeError(msg)
|
|
407
|
+
|
|
408
|
+
object.__setattr__(self, name, value)
|
|
409
|
+
return
|
|
410
|
+
|
|
411
|
+
def __delattr__(self, name):
|
|
412
|
+
if name.startswith("_internal_"):
|
|
413
|
+
# skip test for internal setting
|
|
414
|
+
object.__delattr__(self, name)
|
|
415
|
+
return
|
|
416
|
+
else:
|
|
417
|
+
if name in self._internal_sections:
|
|
418
|
+
self._internal_sections.remove(name)
|
|
419
|
+
if name in self._internal_components:
|
|
420
|
+
self._internal_components.remove(name)
|
|
421
|
+
if name in self._internal_webapps:
|
|
422
|
+
self._internal_webapps.remove(name)
|
|
423
|
+
object.__delattr__(self, name)
|
|
424
|
+
return
|
|
425
|
+
|
|
426
|
+
@staticmethod
|
|
427
|
+
def getInstance():
|
|
428
|
+
return getattr(Configuration, "_instance", None)
|
|
429
|
+
|
|
430
|
+
def listComponents_(self):
|
|
431
|
+
"""
|
|
432
|
+
_listComponents_
|
|
433
|
+
|
|
434
|
+
Retrieve a list of components from the components
|
|
435
|
+
configuration section
|
|
436
|
+
|
|
437
|
+
"""
|
|
438
|
+
comps = self._internal_components
|
|
439
|
+
return comps
|
|
440
|
+
|
|
441
|
+
def listWebapps_(self):
|
|
442
|
+
"""
|
|
443
|
+
_listWebapps_
|
|
444
|
+
|
|
445
|
+
Retrieve a list of webapps from the webapps configuration section.
|
|
446
|
+
"""
|
|
447
|
+
return self._internal_webapps
|
|
448
|
+
|
|
449
|
+
def listSections_(self):
|
|
450
|
+
"""
|
|
451
|
+
_listSections_
|
|
452
|
+
|
|
453
|
+
Retrieve a list of components from the components
|
|
454
|
+
configuration section
|
|
455
|
+
|
|
456
|
+
"""
|
|
457
|
+
comps = self._internal_sections
|
|
458
|
+
return comps
|
|
459
|
+
|
|
460
|
+
def section_(self, sectionName):
|
|
461
|
+
"""
|
|
462
|
+
_section_
|
|
463
|
+
|
|
464
|
+
Get a section by name, create it if not present,
|
|
465
|
+
returns a ConfigSection instance
|
|
466
|
+
|
|
467
|
+
"""
|
|
468
|
+
if sectionName in self.__dict__:
|
|
469
|
+
return self.__dict__[sectionName]
|
|
470
|
+
newSection = ConfigSection(sectionName)
|
|
471
|
+
self.__setattr__(sectionName, newSection)
|
|
472
|
+
self._internal_sections.append(sectionName)
|
|
473
|
+
return object.__getattribute__(self, sectionName)
|
|
474
|
+
|
|
475
|
+
def component_(self, componentName):
|
|
476
|
+
"""
|
|
477
|
+
_component_
|
|
478
|
+
|
|
479
|
+
Get the config for the named component, add it
|
|
480
|
+
if not present, returns a ConfigSection with
|
|
481
|
+
default fields for the component added to it
|
|
482
|
+
|
|
483
|
+
"""
|
|
484
|
+
compSection = self.section_(componentName)
|
|
485
|
+
if componentName not in self._internal_components:
|
|
486
|
+
self._internal_components.append(componentName)
|
|
487
|
+
compSection.componentDir = None
|
|
488
|
+
|
|
489
|
+
return compSection
|
|
490
|
+
|
|
491
|
+
def webapp_(self, webappName):
|
|
492
|
+
"""
|
|
493
|
+
_webapp_
|
|
494
|
+
|
|
495
|
+
Get the config for the named webapp, add it if not present. This will
|
|
496
|
+
return a ConfigSection with default fields for the webapp added to it.
|
|
497
|
+
"""
|
|
498
|
+
webappSection = self.section_(webappName)
|
|
499
|
+
if webappName not in self._internal_webapps:
|
|
500
|
+
self._internal_webapps.append(webappName)
|
|
501
|
+
webappSection.section_("Webtools")
|
|
502
|
+
webappSection.section_("database")
|
|
503
|
+
webappSection.section_("security")
|
|
504
|
+
|
|
505
|
+
return webappSection
|
|
506
|
+
|
|
507
|
+
def pythonise_(self, **options):
|
|
508
|
+
"""
|
|
509
|
+
write as python format
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
document - if True will add document_ calls to the python
|
|
513
|
+
comment - if True will add docs as comments.
|
|
514
|
+
|
|
515
|
+
"""
|
|
516
|
+
document = options.get('document', False)
|
|
517
|
+
comment = options.get('comment', False)
|
|
518
|
+
|
|
519
|
+
result = "from WMCore.Configuration import Configuration\n"
|
|
520
|
+
result += "config = Configuration()\n"
|
|
521
|
+
for sectionName in self._internal_sections:
|
|
522
|
+
if sectionName in self._internal_components:
|
|
523
|
+
result += "config.component_(\'%s\')\n" % sectionName
|
|
524
|
+
elif sectionName in self._internal_webapps:
|
|
525
|
+
result += "config.webapp_(\'%s\')\n" % sectionName
|
|
526
|
+
else:
|
|
527
|
+
result += "config.section_(\'%s\')\n" % sectionName
|
|
528
|
+
|
|
529
|
+
sectionRef = getattr(self, sectionName)
|
|
530
|
+
for sectionAttr in sectionRef.pythonise_(
|
|
531
|
+
document=document, comment=comment):
|
|
532
|
+
if sectionAttr.startswith("#"):
|
|
533
|
+
result += "%s\n" % sectionAttr
|
|
534
|
+
else:
|
|
535
|
+
result += "config.%s\n" % sectionAttr
|
|
536
|
+
|
|
537
|
+
return result
|
|
538
|
+
|
|
539
|
+
def __str__(self):
|
|
540
|
+
"""
|
|
541
|
+
string format of this object
|
|
542
|
+
|
|
543
|
+
"""
|
|
544
|
+
return self.pythonise_()
|
|
545
|
+
|
|
546
|
+
def documentedString_(self):
|
|
547
|
+
"""
|
|
548
|
+
python format with document_ calls
|
|
549
|
+
"""
|
|
550
|
+
return self.pythonise_(document=True)
|
|
551
|
+
|
|
552
|
+
def commentedString_(self):
|
|
553
|
+
"""
|
|
554
|
+
python format with docs as comments
|
|
555
|
+
"""
|
|
556
|
+
return self.pythonise_(comment=True)
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
class ConfigurationEx(Configuration):
|
|
560
|
+
"""
|
|
561
|
+
_Configuration_
|
|
562
|
+
|
|
563
|
+
Top level extended configuration object
|
|
564
|
+
|
|
565
|
+
Allows to freely set parameters of the configuration. Things like callables
|
|
566
|
+
can be used as configuration parameters now. Drawback is that the configuration
|
|
567
|
+
cannot be saved and passed around using the code.
|
|
568
|
+
"""
|
|
569
|
+
|
|
570
|
+
def __init__(self):
|
|
571
|
+
# super(ConfigurationEx, self).__init__()
|
|
572
|
+
Configuration.__init__(self)
|
|
573
|
+
|
|
574
|
+
def section_(self, sectionName):
|
|
575
|
+
"""
|
|
576
|
+
_section_
|
|
577
|
+
|
|
578
|
+
Get a section by name, create it if not present,
|
|
579
|
+
and set the skipChecks flag
|
|
580
|
+
returns a ConfigSection instance
|
|
581
|
+
|
|
582
|
+
"""
|
|
583
|
+
section = Configuration.section_(self, sectionName)
|
|
584
|
+
section._internal_skipChecks = True # pylint: disable=protected-access
|
|
585
|
+
return section
|
|
586
|
+
|
|
587
|
+
|
|
588
|
+
def loadConfigurationFile(filename):
|
|
589
|
+
"""
|
|
590
|
+
_loadConfigurationFile_
|
|
591
|
+
|
|
592
|
+
Load a Configuration File
|
|
593
|
+
|
|
594
|
+
"""
|
|
595
|
+
|
|
596
|
+
cfgBaseName = os.path.basename(filename).replace(".py", "")
|
|
597
|
+
cfgDirName = os.path.dirname(filename)
|
|
598
|
+
if not cfgDirName:
|
|
599
|
+
modSpecs = importlib.machinery.PathFinder().find_spec(cfgBaseName)
|
|
600
|
+
else:
|
|
601
|
+
modSpecs = importlib.machinery.PathFinder().find_spec(cfgBaseName, [cfgDirName])
|
|
602
|
+
try:
|
|
603
|
+
modRef = modSpecs.loader.load_module()
|
|
604
|
+
except Exception as ex:
|
|
605
|
+
msg = "Unable to load Configuration File:\n"
|
|
606
|
+
msg += "%s\n" % filename
|
|
607
|
+
msg += "Due to error:\n"
|
|
608
|
+
msg += str(ex)
|
|
609
|
+
msg += str(traceback.format_exc())
|
|
610
|
+
raise RuntimeError(msg)
|
|
611
|
+
|
|
612
|
+
for attr in listvalues(modRef.__dict__):
|
|
613
|
+
if isinstance(attr, Configuration):
|
|
614
|
+
return attr
|
|
615
|
+
|
|
616
|
+
# //
|
|
617
|
+
# // couldnt find a Configuration instance
|
|
618
|
+
# //
|
|
619
|
+
msg = "Unable to find a Configuration object instance in file:\n"
|
|
620
|
+
msg += "%s\n" % filename
|
|
621
|
+
raise RuntimeError(msg)
|
|
622
|
+
|
|
623
|
+
|
|
624
|
+
def saveConfigurationFile(configInstance, filename, **options):
|
|
625
|
+
"""
|
|
626
|
+
_saveConfigurationFile_
|
|
627
|
+
|
|
628
|
+
Save the configuration as a python module
|
|
629
|
+
Options controls the format of documentation
|
|
630
|
+
|
|
631
|
+
comment = True means save docs as comments
|
|
632
|
+
document = True means save docs as document_ calls
|
|
633
|
+
|
|
634
|
+
|
|
635
|
+
"""
|
|
636
|
+
if isinstance(configInstance, ConfigurationEx):
|
|
637
|
+
raise NotImplementedError("ConfigurationEx instances cannot be saved. Use Configuration instead.")
|
|
638
|
+
comment = options.get("comment", False)
|
|
639
|
+
document = options.get("document", False)
|
|
640
|
+
if document:
|
|
641
|
+
comment = False
|
|
642
|
+
|
|
643
|
+
with open(filename, 'w') as handle:
|
|
644
|
+
if document:
|
|
645
|
+
handle.write(configInstance.documentedString_())
|
|
646
|
+
elif comment:
|
|
647
|
+
handle.write(configInstance.commentedString_())
|
|
648
|
+
else:
|
|
649
|
+
handle.write(str(configInstance))
|
|
650
|
+
|
|
651
|
+
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)
|