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
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
"""
|
|
3
|
+
_WMBSBase_
|
|
4
|
+
|
|
5
|
+
Generic methods used by all of the WMBS classes.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from builtins import object
|
|
9
|
+
|
|
10
|
+
import threading
|
|
11
|
+
|
|
12
|
+
class WorkQueueBase(object):
|
|
13
|
+
"""
|
|
14
|
+
Generic methods used by all of the WMBS classes.
|
|
15
|
+
"""
|
|
16
|
+
def __init__(self, logger=None, dbi=None):
|
|
17
|
+
"""
|
|
18
|
+
___init___
|
|
19
|
+
|
|
20
|
+
Initialize all the database connection attributes and the logging
|
|
21
|
+
attritbutes. Create a DAO factory for WMCore.WorkQueue as well. Finally,
|
|
22
|
+
check to see if a transaction object has been created. If none exists,
|
|
23
|
+
create one but leave the transaction closed.
|
|
24
|
+
"""
|
|
25
|
+
# only load dbi connection if we need it
|
|
26
|
+
if dbi or 'dbi' in dir(threading.currentThread()):
|
|
27
|
+
from WMCore.WMConnectionBase import WMConnectionBase
|
|
28
|
+
self.conn = WMConnectionBase(daoPackage = "WMCore",
|
|
29
|
+
logger = logger, dbi = dbi)
|
|
30
|
+
self.logger = self.conn.logger
|
|
31
|
+
else:
|
|
32
|
+
self.conn = None
|
|
33
|
+
if logger:
|
|
34
|
+
self.logger = logger
|
|
35
|
+
elif 'logger' in dir(threading.currentThread()):
|
|
36
|
+
self.logger = threading.currentThread().logger
|
|
37
|
+
else:
|
|
38
|
+
import logging
|
|
39
|
+
self.logger = logging.getLogger()
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
"""WorkQueue Exceptions"""
|
|
3
|
+
|
|
4
|
+
class WorkQueueError(Exception):
|
|
5
|
+
"""Standard error baseclass"""
|
|
6
|
+
def __init__(self, error):
|
|
7
|
+
Exception.__init__(self, error)
|
|
8
|
+
self.msg = WorkQueueError.__class__.__name__
|
|
9
|
+
self.error = error
|
|
10
|
+
|
|
11
|
+
def __str__(self):
|
|
12
|
+
return "%s: %s" % (self.msg, self.error)
|
|
13
|
+
|
|
14
|
+
class WorkQueueWMSpecError(WorkQueueError):
|
|
15
|
+
"""Problem with the spec file"""
|
|
16
|
+
def __init__(self, wmspec, error):
|
|
17
|
+
WorkQueueError.__init__(self, error)
|
|
18
|
+
self.wmspec = wmspec
|
|
19
|
+
if hasattr(self.wmspec, 'name'):
|
|
20
|
+
self.msg = "Invalid WMSpec: '%s'" % self.wmspec.name()
|
|
21
|
+
else:
|
|
22
|
+
self.msg = "Invalid WMSpec:"
|
|
23
|
+
|
|
24
|
+
class WorkQueueNoWorkError(WorkQueueError):
|
|
25
|
+
"""No work for spec"""
|
|
26
|
+
def __init__(self, wmspec, error):
|
|
27
|
+
WorkQueueError.__init__(self, error)
|
|
28
|
+
self.wmspec = wmspec
|
|
29
|
+
if hasattr(self.wmspec, 'name'):
|
|
30
|
+
self.msg = "No work in spec: '%s' Check inputs" % self.wmspec.name()
|
|
31
|
+
else:
|
|
32
|
+
self.msg = "No work in spec: Check inputs"
|
|
33
|
+
|
|
34
|
+
class WorkQueueNoMatchingElements(WorkQueueError):
|
|
35
|
+
"""Didn't find any element"""
|
|
36
|
+
def __init__(self, error):
|
|
37
|
+
WorkQueueError.__init__(self, error)
|
|
38
|
+
self.msg = WorkQueueNoMatchingElements.__class__.__name__
|
|
39
|
+
self.error = error
|
|
40
|
+
|
|
41
|
+
def __str__(self):
|
|
42
|
+
return "%s: %s" % (self.msg, self.error)
|
|
43
|
+
|
|
44
|
+
TERMINAL_EXCEPTIONS = (WorkQueueWMSpecError, WorkQueueNoWorkError)
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
"""
|
|
3
|
+
Helper class for RequestManager interaction
|
|
4
|
+
"""
|
|
5
|
+
from builtins import object
|
|
6
|
+
from future.utils import viewvalues
|
|
7
|
+
|
|
8
|
+
import logging
|
|
9
|
+
import os
|
|
10
|
+
import socket
|
|
11
|
+
import threading
|
|
12
|
+
import traceback
|
|
13
|
+
from operator import itemgetter
|
|
14
|
+
|
|
15
|
+
from WMCore import Lexicon
|
|
16
|
+
from WMCore.Database.CMSCouch import CouchError, CouchNotFoundError
|
|
17
|
+
from WMCore.Database.CouchUtils import CouchConnectionError
|
|
18
|
+
from WMCore.ReqMgr.DataStructs.RequestStatus import REQUEST_STATE_LIST
|
|
19
|
+
from WMCore.Services.LogDB.LogDB import LogDB
|
|
20
|
+
from WMCore.Services.ReqMgr.ReqMgr import ReqMgr
|
|
21
|
+
from WMCore.Services.Rucio.Rucio import Rucio
|
|
22
|
+
from WMCore.WorkQueue.WorkQueueExceptions import WorkQueueWMSpecError, WorkQueueNoWorkError, TERMINAL_EXCEPTIONS
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class WorkQueueReqMgrInterface(object):
|
|
26
|
+
"""Helper class for ReqMgr interaction"""
|
|
27
|
+
|
|
28
|
+
def __init__(self, **kwargs):
|
|
29
|
+
if not kwargs.get('logger'):
|
|
30
|
+
kwargs['logger'] = logging
|
|
31
|
+
self.logger = kwargs['logger']
|
|
32
|
+
self.rucio = Rucio(kwargs.get("rucioAccount", "wmcore_transferor"),
|
|
33
|
+
configDict=dict(logger=self.logger))
|
|
34
|
+
# this will break all in one test
|
|
35
|
+
self.reqMgr2 = ReqMgr(kwargs.get("reqmgr2_endpoint", None))
|
|
36
|
+
|
|
37
|
+
centralurl = kwargs.get("central_logdb_url", "")
|
|
38
|
+
identifier = kwargs.get("log_reporter", "")
|
|
39
|
+
|
|
40
|
+
# set the thread name before creat the log db.
|
|
41
|
+
# only sets that when it is not set already
|
|
42
|
+
myThread = threading.currentThread()
|
|
43
|
+
if myThread.getName() == "MainThread":
|
|
44
|
+
myThread.setName(self.__class__.__name__)
|
|
45
|
+
|
|
46
|
+
self.logdb = LogDB(centralurl, identifier, logger=self.logger)
|
|
47
|
+
|
|
48
|
+
def __call__(self, queue):
|
|
49
|
+
"""Synchronize WorkQueue and RequestManager"""
|
|
50
|
+
# ensure log records go to the correct logger object
|
|
51
|
+
queue.logger = self.logger
|
|
52
|
+
msg = ''
|
|
53
|
+
try: # Fetch data from ReqMgr and propagate work cancellation to workqueue
|
|
54
|
+
self.logger.info("Canceling aborted and force-completed requests")
|
|
55
|
+
count = self.cancelWork(queue)
|
|
56
|
+
msg += "Work canceled: %s, " % count
|
|
57
|
+
except Exception as ex:
|
|
58
|
+
self.logger.exception("Generic error while canceling work. Details: %s", str(ex))
|
|
59
|
+
|
|
60
|
+
try: # Close requests that no longer need to be open for new data
|
|
61
|
+
self.logger.info("Closing open requests")
|
|
62
|
+
workClosed = queue.closeWork()
|
|
63
|
+
msg += "Work closed: %d, " % len(workClosed)
|
|
64
|
+
except Exception as ex:
|
|
65
|
+
errorMsg = "Generic error while closing open requests. Details: %s"
|
|
66
|
+
self.logger.exception(errorMsg, str(ex))
|
|
67
|
+
|
|
68
|
+
try: # Try to create new work elements for open requests
|
|
69
|
+
self.logger.info("Adding new elements to open requests")
|
|
70
|
+
extraWork = self.addNewElementsToOpenRequests(queue)
|
|
71
|
+
msg += "Work added: %d, " % extraWork
|
|
72
|
+
except Exception as ex:
|
|
73
|
+
errorMsg = "Generic error while adding work to open requests. Details: %s"
|
|
74
|
+
self.logger.exception(errorMsg, str(ex))
|
|
75
|
+
|
|
76
|
+
try: # Pull in work for new requests
|
|
77
|
+
self.logger.info("Queuing work for new requests")
|
|
78
|
+
work = self.queueNewRequests(queue)
|
|
79
|
+
msg += "New Work: %d" % work
|
|
80
|
+
except Exception as ex:
|
|
81
|
+
errorMsg = "Generic error while queuing work for new requests. Details: %s"
|
|
82
|
+
self.logger.exception(errorMsg, str(ex))
|
|
83
|
+
|
|
84
|
+
self.logger.info("Summary of %s: %s", self.__class__.__name__, msg)
|
|
85
|
+
queue.backend.recordTaskActivity('reqmgr_sync', msg)
|
|
86
|
+
|
|
87
|
+
def queueNewRequests(self, queue):
|
|
88
|
+
"""Get requests from regMgr and queue to workqueue"""
|
|
89
|
+
try:
|
|
90
|
+
workLoads = self.getAvailableRequests()
|
|
91
|
+
except Exception as exc:
|
|
92
|
+
msg = "Error contacting RequestManager. Details: %s" % str(exc)
|
|
93
|
+
self.logger.exception(msg)
|
|
94
|
+
return 0
|
|
95
|
+
|
|
96
|
+
work = 0
|
|
97
|
+
for team, reqName, workLoadUrl in workLoads:
|
|
98
|
+
try:
|
|
99
|
+
try:
|
|
100
|
+
Lexicon.couchurl(workLoadUrl)
|
|
101
|
+
except Exception as ex: # can throw many errors e.g. AttributeError, AssertionError etc.
|
|
102
|
+
# check its not a local file
|
|
103
|
+
if not os.path.exists(workLoadUrl):
|
|
104
|
+
error = WorkQueueWMSpecError(None, "Workflow url validation error: %s" % str(ex))
|
|
105
|
+
raise error
|
|
106
|
+
|
|
107
|
+
self.logger.info("Processing request %s at %s" % (reqName, workLoadUrl))
|
|
108
|
+
units = queue.queueWork(workLoadUrl, request=reqName, team=team)
|
|
109
|
+
self.logdb.delete(reqName, "error", this_thread=True, agent=False)
|
|
110
|
+
except TERMINAL_EXCEPTIONS as ex:
|
|
111
|
+
# fatal error - report back to ReqMgr
|
|
112
|
+
self.logger.critical('Permanent failure processing request "%s": %s' % (reqName, str(ex)))
|
|
113
|
+
self.logger.info("Marking request %s as failed in ReqMgr" % reqName)
|
|
114
|
+
self.reportRequestStatus(reqName, 'Failed', message=str(ex))
|
|
115
|
+
continue
|
|
116
|
+
except (IOError, socket.error, CouchError, CouchConnectionError) as ex:
|
|
117
|
+
# temporary problem - try again later
|
|
118
|
+
msg = 'Error processing request "%s": will try again later.' % reqName
|
|
119
|
+
msg += '\nError: "%s"' % str(ex)
|
|
120
|
+
self.logger.error(msg)
|
|
121
|
+
self.logdb.post(reqName, msg, 'error')
|
|
122
|
+
continue
|
|
123
|
+
except Exception as ex:
|
|
124
|
+
# Log exception as it isnt a communication problem
|
|
125
|
+
msg = 'Error processing request "%s": will try again later.' % reqName
|
|
126
|
+
msg += '\nSee log for details.\nError: "%s"' % str(ex)
|
|
127
|
+
self.logger.exception('Unknown error processing %s' % reqName)
|
|
128
|
+
self.logdb.post(reqName, msg, 'error')
|
|
129
|
+
continue
|
|
130
|
+
|
|
131
|
+
self.logger.info('%s units(s) queued for "%s"' % (units, reqName))
|
|
132
|
+
work += units
|
|
133
|
+
|
|
134
|
+
self.logger.info("Total of %s element(s) queued for new requests", work)
|
|
135
|
+
return work
|
|
136
|
+
|
|
137
|
+
def cancelWork(self, queue):
|
|
138
|
+
requests = self.reqMgr2.getRequestByStatus(['aborted', 'force-complete'], detail=False)
|
|
139
|
+
count = 0
|
|
140
|
+
for req in requests:
|
|
141
|
+
try:
|
|
142
|
+
queue.cancelWork(req)
|
|
143
|
+
count += 1
|
|
144
|
+
except CouchNotFoundError as exc:
|
|
145
|
+
msg = 'Failed to cancel workflow: {} because elements are no '.format(req)
|
|
146
|
+
msg += 'longer exist in CouchDB. Details: {}'.format(str(exc))
|
|
147
|
+
except Exception as ex:
|
|
148
|
+
msg = 'Error to cancel the request "%s": %s' % (req, str(ex))
|
|
149
|
+
self.logger.exception(msg)
|
|
150
|
+
return count
|
|
151
|
+
|
|
152
|
+
def deleteFinishedWork(self, queue, elements):
|
|
153
|
+
"""Delete work from queue that is finished in ReqMgr"""
|
|
154
|
+
finished = []
|
|
155
|
+
for element in elements:
|
|
156
|
+
if element.inEndState():
|
|
157
|
+
finished.append(element['RequestName'])
|
|
158
|
+
return queue.deleteWorkflows(*finished)
|
|
159
|
+
|
|
160
|
+
def getAvailableRequests(self):
|
|
161
|
+
"""
|
|
162
|
+
Get available requests and sort by team and priority
|
|
163
|
+
returns [(team, request_name, request_spec_url)]
|
|
164
|
+
"""
|
|
165
|
+
thisStatus = "staged"
|
|
166
|
+
self.logger.info("Contacting ReqMgr for workflows in status: %s", thisStatus)
|
|
167
|
+
tempResults = self.reqMgr2.getRequestByStatus(thisStatus)
|
|
168
|
+
filteredResults = []
|
|
169
|
+
for requests in tempResults:
|
|
170
|
+
for request in viewvalues(requests):
|
|
171
|
+
filteredResults.append(request)
|
|
172
|
+
filteredResults.sort(key=itemgetter('RequestPriority'), reverse=True)
|
|
173
|
+
filteredResults.sort(key=lambda r: r["Team"])
|
|
174
|
+
|
|
175
|
+
results = [(x["Team"], x["RequestName"], x["RequestWorkflow"]) for x in filteredResults]
|
|
176
|
+
|
|
177
|
+
return results
|
|
178
|
+
|
|
179
|
+
def reportRequestStatus(self, request, status, message=None):
|
|
180
|
+
"""Change state in RequestManager
|
|
181
|
+
Optionally, take a message to append to the request
|
|
182
|
+
"""
|
|
183
|
+
if message:
|
|
184
|
+
logType = "error" if status == "Failed" else "info"
|
|
185
|
+
self.logdb.post(request, str(message), logType)
|
|
186
|
+
reqmgrStatus = self._workQueueToReqMgrStatus(status)
|
|
187
|
+
|
|
188
|
+
if reqmgrStatus: # only send known states
|
|
189
|
+
try:
|
|
190
|
+
self.reqMgr2.updateRequestStatus(request, reqmgrStatus)
|
|
191
|
+
except Exception as ex:
|
|
192
|
+
msg = "%s : fail to update status will try later: %s" % (request, str(ex))
|
|
193
|
+
msg += traceback.format_exc()
|
|
194
|
+
self.logdb.post(request, msg, 'warning')
|
|
195
|
+
raise ex
|
|
196
|
+
return
|
|
197
|
+
|
|
198
|
+
def _workQueueToReqMgrStatus(self, status):
|
|
199
|
+
"""Map WorkQueue Status to that reported to ReqMgr"""
|
|
200
|
+
statusMapping = {'Acquired': 'acquired',
|
|
201
|
+
'Running': 'running-open',
|
|
202
|
+
'Failed': 'failed',
|
|
203
|
+
'Canceled': 'aborted',
|
|
204
|
+
'CancelRequested': 'aborted',
|
|
205
|
+
'Done': 'completed'
|
|
206
|
+
}
|
|
207
|
+
if status in statusMapping:
|
|
208
|
+
# if wq status passed convert to reqmgr status
|
|
209
|
+
return statusMapping[status]
|
|
210
|
+
elif status in REQUEST_STATE_LIST:
|
|
211
|
+
# if reqmgr status passed return reqmgr status
|
|
212
|
+
return status
|
|
213
|
+
else:
|
|
214
|
+
# unknown status
|
|
215
|
+
return None
|
|
216
|
+
|
|
217
|
+
def _reqMgrToWorkQueueStatus(self, status):
|
|
218
|
+
"""Map ReqMgr status to that in a WorkQueue element, it is not a 1-1 relation"""
|
|
219
|
+
statusMapping = {'acquired': ['Acquired'],
|
|
220
|
+
'running': ['Running'],
|
|
221
|
+
'running-open': ['Running'],
|
|
222
|
+
'running-closed': ['Running'],
|
|
223
|
+
'failed': ['Failed'],
|
|
224
|
+
'aborted': ['Canceled', 'CancelRequested'],
|
|
225
|
+
'force-complete': ['Canceled', 'CancelRequested'],
|
|
226
|
+
'completed': ['Done']}
|
|
227
|
+
if status in statusMapping:
|
|
228
|
+
return statusMapping[status]
|
|
229
|
+
else:
|
|
230
|
+
return []
|
|
231
|
+
|
|
232
|
+
def reportElement(self, element):
|
|
233
|
+
"""Report element to ReqMgr"""
|
|
234
|
+
self.reportRequestStatus(element['RequestName'], element['Status'])
|
|
235
|
+
|
|
236
|
+
def addNewElementsToOpenRequests(self, queue):
|
|
237
|
+
"""
|
|
238
|
+
Add new elements to open requests according to their
|
|
239
|
+
workqueue_inbox element.
|
|
240
|
+
"""
|
|
241
|
+
self.logger.info("Fetching open requests from WorkQueue")
|
|
242
|
+
|
|
243
|
+
try:
|
|
244
|
+
workInbox = queue.backend.getInboxElements(OpenForNewData=True, loadSpec=True)
|
|
245
|
+
except Exception as exc:
|
|
246
|
+
self.logger.exception("Error retrieving open inbox elements. Details: %s", str(exc))
|
|
247
|
+
return 0
|
|
248
|
+
|
|
249
|
+
self.logger.info("Retrieved %d inbox elements open for new data", len(workInbox))
|
|
250
|
+
work = 0
|
|
251
|
+
for elem in workInbox:
|
|
252
|
+
try:
|
|
253
|
+
units = queue.addWork(elem, rucioObj=self.rucio)
|
|
254
|
+
self.logdb.delete(elem['RequestName'], 'error', True, agent=False)
|
|
255
|
+
except (WorkQueueWMSpecError, WorkQueueNoWorkError) as ex:
|
|
256
|
+
# fatal error - but at least it was split the first time. Log and skip.
|
|
257
|
+
msg = 'Error adding further work to request "%s". ' % elem['RequestName']
|
|
258
|
+
msg += 'Will try again later.\nError: "%s"' % str(ex)
|
|
259
|
+
self.logger.error(msg)
|
|
260
|
+
self.logdb.post(elem['RequestName'], msg, 'error')
|
|
261
|
+
except (IOError, socket.error, CouchError, CouchConnectionError) as ex:
|
|
262
|
+
# temporary problem - try again later
|
|
263
|
+
msg = 'Error processing request "%s": will try again later.' % elem['RequestName']
|
|
264
|
+
msg += '\nError: "%s"' % str(ex)
|
|
265
|
+
self.logger.error(msg)
|
|
266
|
+
self.logdb.post(elem['RequestName'], msg, 'error')
|
|
267
|
+
except Exception as ex:
|
|
268
|
+
# Log exception as it isnt a communication problem
|
|
269
|
+
msg = 'Error processing request "%s". Will try again later. ' % elem['RequestName']
|
|
270
|
+
msg += 'See log for details.\nError: "%s"' % str(ex)
|
|
271
|
+
msg += '\nTraceback: %s' % traceback.format_exc()
|
|
272
|
+
self.logger.exception('Unknown error processing %s' % elem['RequestName'])
|
|
273
|
+
self.logdb.post(elem['RequestName'], msg, 'error')
|
|
274
|
+
else:
|
|
275
|
+
work += units
|
|
276
|
+
|
|
277
|
+
self.logger.info("%s element(s) added to open requests" % work)
|
|
278
|
+
return work
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
"""Various helper functions for workqueue"""
|
|
3
|
+
|
|
4
|
+
import logging
|
|
5
|
+
import os
|
|
6
|
+
from WMCore.Services.CRIC.CRIC import CRIC
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
__dbses = {}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def get_dbs(url):
|
|
13
|
+
"""Return DBS object for url"""
|
|
14
|
+
try:
|
|
15
|
+
return __dbses[url]
|
|
16
|
+
except KeyError:
|
|
17
|
+
from WMCore.Services.DBS.DBSReader import DBSReader
|
|
18
|
+
__dbses[url] = DBSReader(url)
|
|
19
|
+
return __dbses[url]
|
|
20
|
+
|
|
21
|
+
__cric = None
|
|
22
|
+
__cmsSiteNames = []
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def cmsSiteNames():
|
|
26
|
+
"""Get all cms sites"""
|
|
27
|
+
global __cmsSiteNames
|
|
28
|
+
if __cmsSiteNames:
|
|
29
|
+
return __cmsSiteNames
|
|
30
|
+
global __cric
|
|
31
|
+
if not __cric:
|
|
32
|
+
__cric = CRIC()
|
|
33
|
+
|
|
34
|
+
try:
|
|
35
|
+
__cmsSiteNames = __cric.getAllPSNs()
|
|
36
|
+
except Exception:
|
|
37
|
+
pass
|
|
38
|
+
return __cmsSiteNames
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def makeLocationsList(siteWhitelist, siteBlacklist):
|
|
42
|
+
"""
|
|
43
|
+
_makeLocationsList_
|
|
44
|
+
|
|
45
|
+
Make a location list based on the intersection between a site white list
|
|
46
|
+
and blacklist, if none specified then all sites are listed.
|
|
47
|
+
"""
|
|
48
|
+
sites = cmsSiteNames()
|
|
49
|
+
if siteWhitelist:
|
|
50
|
+
# Just get the CMS sites matching the whitelists
|
|
51
|
+
sites = list(set(sites) & set(siteWhitelist))
|
|
52
|
+
if siteBlacklist:
|
|
53
|
+
# Get all CMS sites less the blacklist
|
|
54
|
+
sites = list(set(sites) - set(siteBlacklist))
|
|
55
|
+
return sites
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def queueFromConfig(config):
|
|
59
|
+
"""Create a queue from the config object"""
|
|
60
|
+
config = queueConfigFromConfigObject(config)
|
|
61
|
+
if config.WorkQueueManager.level == 'GlobalQueue':
|
|
62
|
+
from WMCore.WorkQueue.WorkQueue import globalQueue
|
|
63
|
+
return globalQueue(**config.WorkQueueManager.queueParams)
|
|
64
|
+
elif config.WorkQueueManager.level == 'LocalQueue':
|
|
65
|
+
from WMCore.WorkQueue.WorkQueue import localQueue
|
|
66
|
+
return localQueue(**config.WorkQueueManager.queueParams)
|
|
67
|
+
else:
|
|
68
|
+
from WMCore.WorkQueue.WorkQueue import WorkQueue
|
|
69
|
+
return WorkQueue(**config.WorkQueueManager.queueParams)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def queueConfigFromConfigObject(config):
|
|
73
|
+
"""From a config object create a config dict suitable for a queue object"""
|
|
74
|
+
from os import path
|
|
75
|
+
wqManager = config.section_('WorkQueueManager')
|
|
76
|
+
|
|
77
|
+
if not hasattr(wqManager, 'componentDir'):
|
|
78
|
+
wqManager.componentDir = path.join(config.General.WorkDir,
|
|
79
|
+
'WorkQueueManager')
|
|
80
|
+
if not hasattr(wqManager, 'namespace'):
|
|
81
|
+
wqManager.namespace = 'WMComponent.WorkQueueManager.WorkQueueManager'
|
|
82
|
+
if not hasattr(wqManager, 'logLevel'):
|
|
83
|
+
wqManager.logLevel = 'INFO'
|
|
84
|
+
if not hasattr(wqManager, 'pollInterval'):
|
|
85
|
+
wqManager.pollInterval = 600
|
|
86
|
+
|
|
87
|
+
# WorkQueue config
|
|
88
|
+
if not hasattr(wqManager, 'queueParams'):
|
|
89
|
+
wqManager.queueParams = {}
|
|
90
|
+
qConfig = wqManager.queueParams
|
|
91
|
+
|
|
92
|
+
# Rucio-related config
|
|
93
|
+
if hasattr(wqManager, 'rucioUrl'):
|
|
94
|
+
qConfig['rucioUrl'] = wqManager.rucioUrl
|
|
95
|
+
if hasattr(wqManager, 'rucioAuthUrl'):
|
|
96
|
+
qConfig['rucioAuthUrl'] = wqManager.rucioAuthUrl
|
|
97
|
+
|
|
98
|
+
if hasattr(wqManager, 'couchurl'):
|
|
99
|
+
qConfig['CouchUrl'] = wqManager.couchurl
|
|
100
|
+
if hasattr(wqManager, 'dbname'):
|
|
101
|
+
qConfig['DbName'] = wqManager.dbname
|
|
102
|
+
if hasattr(wqManager, 'inboxDatabase'):
|
|
103
|
+
qConfig['InboxDbName'] = wqManager.inboxDatabase
|
|
104
|
+
|
|
105
|
+
# pull some info we need from other areas of the config
|
|
106
|
+
if "BossAirConfig" not in qConfig and hasattr(config, 'BossAir'):
|
|
107
|
+
qConfig["BossAirConfig"] = config
|
|
108
|
+
qConfig['BossAirConfig'].section_("Agent").agentName = config.Agent.agentName
|
|
109
|
+
if "JobDumpConfig" not in qConfig and hasattr(config, 'JobStateMachine'):
|
|
110
|
+
qConfig["JobDumpConfig"] = config
|
|
111
|
+
if "CacheDir" not in qConfig and getattr(config.WorkQueueManager, 'componentDir', None):
|
|
112
|
+
qConfig['CacheDir'] = os.path.join(config.WorkQueueManager.componentDir, 'cache')
|
|
113
|
+
|
|
114
|
+
if 'Team' not in qConfig and hasattr(config.Agent, 'teamName'):
|
|
115
|
+
qConfig['Team'] = config.Agent.teamName
|
|
116
|
+
if 'logger' not in qConfig:
|
|
117
|
+
import threading
|
|
118
|
+
myThread = threading.currentThread()
|
|
119
|
+
if not hasattr(myThread, 'logger'):
|
|
120
|
+
loggingLevelName = getattr(wqManager, 'logLevel', 'INFO')
|
|
121
|
+
logging.basicConfig(format='%(asctime)-15s %(levelname)-8s %(module)s: %(message)s',
|
|
122
|
+
level=getattr(logging, loggingLevelName))
|
|
123
|
+
myThread.logger = logging.getLogger('workqueue')
|
|
124
|
+
qConfig['logger'] = myThread.logger
|
|
125
|
+
|
|
126
|
+
# ReqMgr params
|
|
127
|
+
if not hasattr(wqManager, 'reqMgrConfig'):
|
|
128
|
+
wqManager.reqMgrConfig = {}
|
|
129
|
+
|
|
130
|
+
return config
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
"""
|
|
3
|
+
_WorkQueue_
|
|
4
|
+
|
|
5
|
+
WorkQueue provides functionality to queue large chunks of work,
|
|
6
|
+
thus acting as a buffer for the next steps in job processing
|
|
7
|
+
|
|
8
|
+
WMSpec objects are fed into the queue, split into coarse grained work units
|
|
9
|
+
and released when a suitable resource is found to execute them.
|
|
10
|
+
|
|
11
|
+
https://twiki.cern.ch/twiki/bin/view/CMS/WMCoreJobPool
|
|
12
|
+
"""
|
|
13
|
+
__all__ = []
|