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,155 @@
|
|
|
1
|
+
from __future__ import (division, print_function)
|
|
2
|
+
from future import standard_library
|
|
3
|
+
|
|
4
|
+
from Utils.Utilities import decodeBytesToUnicode
|
|
5
|
+
|
|
6
|
+
standard_library.install_aliases()
|
|
7
|
+
|
|
8
|
+
import logging
|
|
9
|
+
from urllib.parse import urlparse
|
|
10
|
+
|
|
11
|
+
from collections import defaultdict
|
|
12
|
+
from WMCore.Services.Service import Service
|
|
13
|
+
from WMCore.Services.TagCollector.XMLUtils import xml_parser
|
|
14
|
+
|
|
15
|
+
class TagCollector(Service):
|
|
16
|
+
"""
|
|
17
|
+
Class which provides interface to CMS TagCollector web-service.
|
|
18
|
+
Provides non-deprecated CMSSW releases in all their ScramArchs (not only prod)
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
def __init__(self, url=None, logger=None, configDict=None, **kwargs):
|
|
22
|
+
"""
|
|
23
|
+
responseType will be either xml or json
|
|
24
|
+
"""
|
|
25
|
+
defaultURL = "https://cmssdt.cern.ch/SDT/cgi-bin/ReleasesXML"
|
|
26
|
+
url = url or defaultURL
|
|
27
|
+
parsedUrl = urlparse(url)
|
|
28
|
+
self.cFileUrlPath = parsedUrl.path.replace("/", "_")
|
|
29
|
+
# all releases types and all their archs
|
|
30
|
+
self.tcArgs = kwargs
|
|
31
|
+
self.tcArgs.setdefault("anytype", 1)
|
|
32
|
+
self.tcArgs.setdefault("anyarch", 1)
|
|
33
|
+
|
|
34
|
+
configDict = configDict or {}
|
|
35
|
+
configDict.setdefault('endpoint', url)
|
|
36
|
+
configDict.setdefault("timeout", 300)
|
|
37
|
+
configDict.setdefault('cacheduration', 1)
|
|
38
|
+
configDict['logger'] = logger if logger else logging.getLogger()
|
|
39
|
+
super(TagCollector, self).__init__(configDict)
|
|
40
|
+
self['logger'].debug("Initializing TagCollector with url: %s", self['endpoint'])
|
|
41
|
+
|
|
42
|
+
def _getResult(self, callname="", clearCache=False,
|
|
43
|
+
args=None, verb="GET", encoder=None, decoder=None,
|
|
44
|
+
contentType=None):
|
|
45
|
+
"""
|
|
46
|
+
_getResult_
|
|
47
|
+
|
|
48
|
+
retrieve JSON/XML formatted information given the service name and the
|
|
49
|
+
argument dictionaries
|
|
50
|
+
|
|
51
|
+
TODO: Probably want to move this up into Service
|
|
52
|
+
"""
|
|
53
|
+
if not args:
|
|
54
|
+
args = self.tcArgs
|
|
55
|
+
|
|
56
|
+
cFile = '%s_%s'% (self.cFileUrlPath, callname.replace("/", "_"))
|
|
57
|
+
# If no callname or url path, the base host is getting queried
|
|
58
|
+
if cFile == '_':
|
|
59
|
+
cFile = 'baseRequest'
|
|
60
|
+
|
|
61
|
+
if clearCache:
|
|
62
|
+
self.clearCache(cFile, args, verb)
|
|
63
|
+
|
|
64
|
+
# Note cFile is just the base name pattern, args
|
|
65
|
+
# are also considered for the end filename in the method below
|
|
66
|
+
f = self.refreshCache(cFile, callname, args, encoder=encoder, decoder=decodeBytesToUnicode,
|
|
67
|
+
verb=verb, contentType=contentType)
|
|
68
|
+
result = f.read()
|
|
69
|
+
f.close()
|
|
70
|
+
|
|
71
|
+
# overhead from REST model which returns results as strings or None
|
|
72
|
+
# therefore they can be encoded by JSON to None, etc.
|
|
73
|
+
if result == 'None':
|
|
74
|
+
return
|
|
75
|
+
if result and decoder:
|
|
76
|
+
result = decoder(result)
|
|
77
|
+
return result
|
|
78
|
+
|
|
79
|
+
def data(self):
|
|
80
|
+
"Fetch data from tag collector or local cache"
|
|
81
|
+
data = self._getResult()
|
|
82
|
+
pkey = 'architecture'
|
|
83
|
+
for row in xml_parser(data, pkey):
|
|
84
|
+
yield row[pkey]
|
|
85
|
+
|
|
86
|
+
def releases(self, arch=None):
|
|
87
|
+
"Yield CMS releases known in tag collector"
|
|
88
|
+
arr = []
|
|
89
|
+
for row in self.data():
|
|
90
|
+
if arch:
|
|
91
|
+
if arch == row['name']:
|
|
92
|
+
for item in row['project']:
|
|
93
|
+
arr.append(item['label'])
|
|
94
|
+
else:
|
|
95
|
+
for item in row['project']:
|
|
96
|
+
arr.append(item['label'])
|
|
97
|
+
return list(set(arr))
|
|
98
|
+
|
|
99
|
+
def architectures(self):
|
|
100
|
+
"Yield CMS architectures known in tag collector"
|
|
101
|
+
arr = []
|
|
102
|
+
for row in self.data():
|
|
103
|
+
arr.append(row['name'])
|
|
104
|
+
return list(set(arr))
|
|
105
|
+
|
|
106
|
+
def releases_by_architecture(self):
|
|
107
|
+
"returns CMS architectures and realease in dictionary format"
|
|
108
|
+
arch_dict = defaultdict(list)
|
|
109
|
+
for row in self.data():
|
|
110
|
+
releases = set()
|
|
111
|
+
for item in row['project']:
|
|
112
|
+
releases.add(item['label'])
|
|
113
|
+
arch_dict[row['name']].extend(list(releases))
|
|
114
|
+
return dict(arch_dict)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def defaultMicroArchVersionNumberByRelease(self, default_microarch=0):
|
|
118
|
+
"""
|
|
119
|
+
Yield default microarchitecture by CMS release known in tag collector.
|
|
120
|
+
|
|
121
|
+
:param default_microarch: int, default microar when not found in TagCollector XML file.
|
|
122
|
+
:return: dictionary ("release": default_microarch (or default_microarch if not found)).
|
|
123
|
+
"""
|
|
124
|
+
rel_microarchs = {}
|
|
125
|
+
for row in self.data():
|
|
126
|
+
for item in row['project']:
|
|
127
|
+
microarch = item.get('default_micro_arch', default_microarch)
|
|
128
|
+
if isinstance(microarch, str):
|
|
129
|
+
# format of this value is "arch-vN"
|
|
130
|
+
microarch = int((microarch.split("-")[-1]).lstrip("v"))
|
|
131
|
+
rel_microarchs[item['label']] = microarch
|
|
132
|
+
return rel_microarchs
|
|
133
|
+
|
|
134
|
+
def getGreaterMicroarchVersionNumber(self, releases=None, default_microarch=0, rel_microarchs=None):
|
|
135
|
+
"""
|
|
136
|
+
Return the greated default microarchitecture, given a list of releases.
|
|
137
|
+
|
|
138
|
+
:param releases: str, comma-separated list of releases.
|
|
139
|
+
:param default_microarch: int, default microar when not found in TagCollector XML file.
|
|
140
|
+
:return: int, greater default microarchitecture version number.
|
|
141
|
+
"""
|
|
142
|
+
if releases is None:
|
|
143
|
+
return default_microarch
|
|
144
|
+
|
|
145
|
+
if rel_microarchs is None:
|
|
146
|
+
rel_microarchs = self.defaultMicroArchVersionNumberByRelease()
|
|
147
|
+
|
|
148
|
+
releases = releases.split(",")
|
|
149
|
+
microarch = default_microarch
|
|
150
|
+
for r in releases:
|
|
151
|
+
m = rel_microarchs.get(r, default_microarch)
|
|
152
|
+
if m > microarch:
|
|
153
|
+
microarch = m
|
|
154
|
+
|
|
155
|
+
return microarch
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# encoding: utf-8
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
File : XMLUtils.py
|
|
6
|
+
Author : Valentin Kuznetsov <vkuznet AT gmail dot com>
|
|
7
|
+
Description: Set of utilities for RequestManager code
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import (division, print_function)
|
|
11
|
+
from builtins import str, bytes
|
|
12
|
+
from Utils.Utilities import encodeUnicodeToBytes
|
|
13
|
+
|
|
14
|
+
from io import BytesIO
|
|
15
|
+
import re
|
|
16
|
+
import xml.etree.cElementTree as ET
|
|
17
|
+
|
|
18
|
+
int_number_pattern = re.compile(r'(^[0-9-]$|^[0-9-][0-9]*$)')
|
|
19
|
+
float_number_pattern = re.compile(r'(^[-]?\d+\.\d*$|^\d*\.{1,1}\d+$)')
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def adjust_value(value):
|
|
23
|
+
"""
|
|
24
|
+
Change null value to None.
|
|
25
|
+
"""
|
|
26
|
+
pat_float = float_number_pattern
|
|
27
|
+
pat_integer = int_number_pattern
|
|
28
|
+
if isinstance(value, str):
|
|
29
|
+
if value == 'null' or value == '(null)':
|
|
30
|
+
return None
|
|
31
|
+
elif pat_float.match(value):
|
|
32
|
+
return float(value)
|
|
33
|
+
elif pat_integer.match(value):
|
|
34
|
+
return int(value)
|
|
35
|
+
else:
|
|
36
|
+
return value
|
|
37
|
+
else:
|
|
38
|
+
return value
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def xml_parser(data, prim_key):
|
|
42
|
+
"""
|
|
43
|
+
Generic XML parser
|
|
44
|
+
|
|
45
|
+
:param data: can be of type "file object", unicode string or bytes string
|
|
46
|
+
"""
|
|
47
|
+
if isinstance(data, (str, bytes)):
|
|
48
|
+
stream = BytesIO()
|
|
49
|
+
data = encodeUnicodeToBytes(data, "ignore")
|
|
50
|
+
stream.write(data)
|
|
51
|
+
stream.seek(0)
|
|
52
|
+
else:
|
|
53
|
+
stream = data
|
|
54
|
+
|
|
55
|
+
context = ET.iterparse(stream)
|
|
56
|
+
for event, elem in context:
|
|
57
|
+
row = {}
|
|
58
|
+
key = elem.tag
|
|
59
|
+
if key != prim_key:
|
|
60
|
+
continue
|
|
61
|
+
row[key] = elem.attrib
|
|
62
|
+
get_children(elem, event, row, key)
|
|
63
|
+
elem.clear()
|
|
64
|
+
yield row
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def get_children(elem, event, row, key):
|
|
68
|
+
"""
|
|
69
|
+
xml_parser helper function. It gets recursively information about
|
|
70
|
+
children for given element tag. Information is stored into provided
|
|
71
|
+
row for given key. The change of notations can be applied during
|
|
72
|
+
parsing step by using provided notations dictionary.
|
|
73
|
+
"""
|
|
74
|
+
for child in list(elem):
|
|
75
|
+
child_key = child.tag
|
|
76
|
+
child_data = child.attrib
|
|
77
|
+
if not child_data:
|
|
78
|
+
child_dict = adjust_value(child.text)
|
|
79
|
+
else:
|
|
80
|
+
child_dict = child_data
|
|
81
|
+
|
|
82
|
+
if list(child): # we got grand-children
|
|
83
|
+
if child_dict:
|
|
84
|
+
row[key][child_key] = child_dict
|
|
85
|
+
else:
|
|
86
|
+
row[key][child_key] = {}
|
|
87
|
+
if isinstance(child_dict, dict):
|
|
88
|
+
newdict = {child_key: child_dict}
|
|
89
|
+
else:
|
|
90
|
+
newdict = {child_key: {}}
|
|
91
|
+
get_children(child, event, newdict, child_key)
|
|
92
|
+
row[key][child_key] = newdict[child_key]
|
|
93
|
+
else:
|
|
94
|
+
if not isinstance(row[key], dict):
|
|
95
|
+
row[key] = {}
|
|
96
|
+
row[key].setdefault(child_key, [])
|
|
97
|
+
row[key][child_key].append(child_dict)
|
|
98
|
+
child.clear()
|
|
File without changes
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
"""
|
|
3
|
+
_UserFileCache_
|
|
4
|
+
|
|
5
|
+
API for UserFileCache service
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from builtins import str, bytes
|
|
9
|
+
|
|
10
|
+
import os
|
|
11
|
+
import json
|
|
12
|
+
import shutil
|
|
13
|
+
import hashlib
|
|
14
|
+
import tarfile
|
|
15
|
+
import tempfile
|
|
16
|
+
|
|
17
|
+
from Utils.Utilities import encodeUnicodeToBytesConditional
|
|
18
|
+
from Utils.PythonVersion import PY3
|
|
19
|
+
|
|
20
|
+
from WMCore.Services.Service import Service
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def calculateChecksum(tarfile_, exclude=None):
|
|
24
|
+
"""
|
|
25
|
+
Calculate the checksum of the tar file in input.
|
|
26
|
+
|
|
27
|
+
The tarfile_ input parameter could be a string or a file object (anything compatible
|
|
28
|
+
with the fileobj parameter of tarfile.open).
|
|
29
|
+
|
|
30
|
+
The exclude parameter could be a list of strings, or a callable that takes as input
|
|
31
|
+
the output of the list of tarfile.getmembers() and return a list of strings.
|
|
32
|
+
The exclude param is interpreted as a list of files that will not be taken into consideration
|
|
33
|
+
when calculating the checksum.
|
|
34
|
+
|
|
35
|
+
The output is the checksum of the tar input file.
|
|
36
|
+
|
|
37
|
+
The checksum is calculated taking into consideration the names of the objects
|
|
38
|
+
in the tarfile (files, directories etc) and the content of each file.
|
|
39
|
+
|
|
40
|
+
Each file is exctracted, read, and then deleted right after the input is passed
|
|
41
|
+
to the hasher object. The file is read in chuncks of 4096 bytes to avoid memory
|
|
42
|
+
issues.
|
|
43
|
+
"""
|
|
44
|
+
if exclude==None: #[] is a dangerous value for a param
|
|
45
|
+
exclude = []
|
|
46
|
+
|
|
47
|
+
hasher = hashlib.sha256()
|
|
48
|
+
|
|
49
|
+
## "massage" out the input parameters
|
|
50
|
+
if isinstance(tarfile_, (str, bytes)):
|
|
51
|
+
tar = tarfile.open(tarfile_, mode='r')
|
|
52
|
+
else:
|
|
53
|
+
tar = tarfile.open(fileobj=tarfile_, mode='r')
|
|
54
|
+
|
|
55
|
+
if exclude and hasattr(exclude, '__call__'):
|
|
56
|
+
excludeList = exclude(tar.getmembers())
|
|
57
|
+
else:
|
|
58
|
+
excludeList = exclude
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
tmpDir = tempfile.mkdtemp()
|
|
62
|
+
try:
|
|
63
|
+
for tarmember in tar:
|
|
64
|
+
if tarmember.name in excludeList:
|
|
65
|
+
continue
|
|
66
|
+
hasher.update(encodeUnicodeToBytesConditional(tarmember.name, condition=PY3))
|
|
67
|
+
if tarmember.isfile() and tarmember.name.split('.')[-1]!='pkl':
|
|
68
|
+
tar.extractall(path=tmpDir, members=[tarmember])
|
|
69
|
+
fn = os.path.join(tmpDir, tarmember.name)
|
|
70
|
+
with open(fn, 'rb') as fd:
|
|
71
|
+
while True:
|
|
72
|
+
buf = fd.read(4096)
|
|
73
|
+
if not buf:
|
|
74
|
+
break
|
|
75
|
+
hasher.update(buf)
|
|
76
|
+
os.remove(fn)
|
|
77
|
+
finally:
|
|
78
|
+
#never leave tmddir around
|
|
79
|
+
shutil.rmtree(tmpDir)
|
|
80
|
+
checksum = hasher.hexdigest()
|
|
81
|
+
|
|
82
|
+
return checksum
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class UserFileCache(Service):
|
|
86
|
+
"""
|
|
87
|
+
API for UserFileCache service
|
|
88
|
+
"""
|
|
89
|
+
# Should be filled out with other methods: download, exists
|
|
90
|
+
|
|
91
|
+
def __init__(self, mydict=None):
|
|
92
|
+
if mydict==None: #dangerous {} default value
|
|
93
|
+
mydict = {}
|
|
94
|
+
mydict['endpoint'] = mydict.get('endpoint', 'https://cmsweb.cern.ch/crabcache/')
|
|
95
|
+
Service.__init__(self, mydict)
|
|
96
|
+
self['requests']['accept_type'] = 'application/json'
|
|
97
|
+
|
|
98
|
+
if 'proxyfilename' in mydict:
|
|
99
|
+
#in case there is some code I have not updated in ticket #3780. Should not be required... but...
|
|
100
|
+
self['logger'].warning('The UserFileCache proxyfilename parameter has been replace with the more'
|
|
101
|
+
' general (ckey/cert) pair.')
|
|
102
|
+
|
|
103
|
+
def downloadLog(self, fileName, output):
|
|
104
|
+
"""
|
|
105
|
+
"""
|
|
106
|
+
url = self['endpoint'] + 'logfile?name=%s' % os.path.split(fileName)[1]
|
|
107
|
+
|
|
108
|
+
self['logger'].info('Fetching URL %s' % url)
|
|
109
|
+
fileName, dummyHeader = self['requests'].downloadFile(output, str(url)) #unicode broke pycurl.setopt
|
|
110
|
+
self['logger'].debug('Wrote %s' % output)
|
|
111
|
+
return fileName
|
|
112
|
+
|
|
113
|
+
def uploadLog(self, fileName, uploadName=None):
|
|
114
|
+
"""
|
|
115
|
+
"""
|
|
116
|
+
if not uploadName:
|
|
117
|
+
uploadName = os.path.split(fileName)[1]
|
|
118
|
+
params = [('name', uploadName)]
|
|
119
|
+
|
|
120
|
+
resString = self["requests"].uploadFile(fileName=fileName, fieldName='inputfile',
|
|
121
|
+
url=self['endpoint'] + 'logfile',
|
|
122
|
+
params=params, verb='PUT')
|
|
123
|
+
|
|
124
|
+
return json.loads(resString)['result'][0]
|
|
125
|
+
|
|
126
|
+
def removeFile(self, haskey):
|
|
127
|
+
result=self['requests'].makeRequest(uri = 'info', data = {'subresource':'fileremove', 'hashkey': haskey})
|
|
128
|
+
return json.loads(result[0])['result'][0]
|
|
129
|
+
|
|
130
|
+
def download(self, hashkey, output, username=None):
|
|
131
|
+
"""
|
|
132
|
+
Download tarfile with the provided hashkey.
|
|
133
|
+
"""
|
|
134
|
+
url = self['endpoint'] + 'file?hashkey=%s' % hashkey
|
|
135
|
+
if username:
|
|
136
|
+
url = url + '&username=%s' % username
|
|
137
|
+
|
|
138
|
+
self['logger'].info('Fetching URL %s' % url)
|
|
139
|
+
fileName, dummyHeader = self['requests'].downloadFile(output, str(url)) # unicode broke pycurl.setopt
|
|
140
|
+
self['logger'].debug('Wrote %s' % fileName)
|
|
141
|
+
return fileName
|
|
142
|
+
|
|
143
|
+
def upload(self, fileName, excludeList = None):
|
|
144
|
+
"""
|
|
145
|
+
Upload the tarfile fileName to the user file cache. Returns the hash of the content of the file
|
|
146
|
+
which can be used to retrieve the file later on.
|
|
147
|
+
"""
|
|
148
|
+
if excludeList==None: #pylint says [] is a dangerous default value
|
|
149
|
+
excludeList = []
|
|
150
|
+
|
|
151
|
+
#The parameter newchecksum tells the crabcache to use the new algorithm. It's there
|
|
152
|
+
#to guarantee backward compatibility.
|
|
153
|
+
params = [('hashkey', calculateChecksum(fileName, excludeList)), ('newchecksum', '2')]
|
|
154
|
+
|
|
155
|
+
resString = self["requests"].uploadFile(fileName=fileName, fieldName='inputfile',
|
|
156
|
+
url=self['endpoint'] + 'file',
|
|
157
|
+
params=params, verb='PUT')
|
|
158
|
+
|
|
159
|
+
return json.loads(resString)['result'][0]
|
|
160
|
+
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import json
|
|
2
|
+
|
|
3
|
+
from WMCore.Services.Service import Service
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class WMAgent(Service):
|
|
7
|
+
|
|
8
|
+
"""
|
|
9
|
+
API for dealing with retrieving information from WMAgent RESTModel Service
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
def __init__(self, dict={}):
|
|
13
|
+
"""
|
|
14
|
+
responseType will be JSON
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
dict.setdefault("accept_type", "application/json")
|
|
18
|
+
dict.setdefault("content_type", "application/json")
|
|
19
|
+
self.encoder = json.dumps
|
|
20
|
+
self.decoder = json.loads
|
|
21
|
+
|
|
22
|
+
Service.__init__(self, dict)
|
|
23
|
+
|
|
24
|
+
def _getResult(self, callname, clearCache = True,
|
|
25
|
+
args = None, verb="GET", contentType = None):
|
|
26
|
+
"""
|
|
27
|
+
_getResult_
|
|
28
|
+
|
|
29
|
+
retrieve JSON/XML formatted information given the service name and the
|
|
30
|
+
argument dictionaries
|
|
31
|
+
|
|
32
|
+
TODO: Probably want to move this up into Service
|
|
33
|
+
"""
|
|
34
|
+
result = ''
|
|
35
|
+
# make base file name from call name.
|
|
36
|
+
file = callname.replace("/", "_")
|
|
37
|
+
if clearCache:
|
|
38
|
+
self.clearCache(file, args, verb)
|
|
39
|
+
|
|
40
|
+
# can't pass the decoder here since refreshCache wright to file
|
|
41
|
+
f = self.refreshCache(file, callname, args, encoder = self.encoder,
|
|
42
|
+
verb = verb, contentType = contentType)
|
|
43
|
+
result = f.read()
|
|
44
|
+
f.close()
|
|
45
|
+
result = self.decoder(result)
|
|
46
|
+
|
|
47
|
+
return result
|
|
48
|
+
|
|
49
|
+
def getAgentStatus(self, detail = False):
|
|
50
|
+
"""
|
|
51
|
+
"""
|
|
52
|
+
callname = 'agentstatus'
|
|
53
|
+
# TODO support detail flag if it is needed
|
|
54
|
+
# need to convert to boolean on serverside
|
|
55
|
+
#args = {'detail': detail}
|
|
56
|
+
args = {}
|
|
57
|
+
return self._getResult(callname, args = args)
|
|
58
|
+
|
|
59
|
+
def getACDCInfo(self):
|
|
60
|
+
"""
|
|
61
|
+
"""
|
|
62
|
+
callname = 'acdclink'
|
|
63
|
+
return self._getResult(callname)
|
|
File without changes
|