wmglobalqueue 2.4.5.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- Utils/CPMetrics.py +270 -0
- Utils/CertTools.py +100 -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/ProcFS.py +112 -0
- Utils/ProcessStats.py +194 -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 +318 -0
- Utils/__init__.py +11 -0
- Utils/wmcoreDTools.py +707 -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 +659 -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 +1430 -0
- WMCore/Database/ConfigDBMap.py +29 -0
- WMCore/Database/CouchMonitoring.py +450 -0
- WMCore/Database/CouchUtils.py +118 -0
- WMCore/Database/DBCore.py +198 -0
- WMCore/Database/DBCreator.py +113 -0
- WMCore/Database/DBExceptionHandler.py +59 -0
- WMCore/Database/DBFactory.py +117 -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 +636 -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 +112 -0
- WMCore/Services/DBS/DBSReader.py +23 -0
- WMCore/Services/DBS/DBSUtils.py +166 -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/__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 +1290 -0
- WMCore/Services/Rucio/RucioUtils.py +74 -0
- WMCore/Services/Rucio/__init__.py +0 -0
- WMCore/Services/RucioConMon/RucioConMon.py +121 -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 +377 -0
- WMCore/WMLogging.py +104 -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 +1997 -0
- WMCore/WMSpec/WMWorkload.py +2288 -0
- WMCore/WMSpec/WMWorkloadTools.py +382 -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.4.5.1.data/data/bin/wmc-dist-patch +15 -0
- wmglobalqueue-2.4.5.1.data/data/bin/wmc-dist-unpatch +8 -0
- wmglobalqueue-2.4.5.1.data/data/bin/wmc-httpd +3 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/.couchapprc +1 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/README.md +40 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/_attachments/index.html +264 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/_attachments/js/ElementInfoByWorkflow.js +96 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/_attachments/js/StuckElementInfo.js +57 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/_attachments/js/WorkloadInfoTable.js +80 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/_attachments/js/dataTable.js +70 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/_attachments/js/namespace.js +23 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/_attachments/style/main.css +75 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/couchapp.json +4 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/filters/childQueueFilter.js +13 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/filters/filterDeletedDocs.js +3 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/filters/queueFilter.js +11 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/language +1 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/lib/mustache.js +333 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/lib/validate.js +27 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/lib/workqueue_utils.js +61 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/lists/elementsDetail.js +28 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/lists/filter.js +86 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/lists/stuckElements.js +38 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/lists/workRestrictions.js +153 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/lists/workflowSummary.js +28 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/rewrites.json +73 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/shows/redirect.js +23 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/shows/status.js +40 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/templates/ElementSummaryByWorkflow.html +27 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/templates/StuckElementSummary.html +26 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/templates/TaskStatus.html +23 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/templates/WorkflowSummary.html +27 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/templates/partials/workqueue-common-lib.html +2 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/templates/partials/yui-lib-remote.html +16 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/templates/partials/yui-lib.html +18 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/updates/in-place.js +50 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/validate_doc_update.js +8 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/vendor/couchapp/_attachments/jquery.couch.app.js +235 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/vendor/couchapp/_attachments/jquery.pathbinder.js +173 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/activeData/map.js +8 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/activeData/reduce.js +2 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/activeParentData/map.js +8 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/activeParentData/reduce.js +2 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/activePileupData/map.js +8 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/activePileupData/reduce.js +2 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/analyticsData/map.js +11 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/analyticsData/reduce.js +1 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/availableByPriority/map.js +6 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/conflicts/map.js +5 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/elements/map.js +5 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/elementsByData/map.js +8 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/elementsByParent/map.js +8 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/elementsByParentData/map.js +8 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/elementsByPileupData/map.js +8 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/elementsByStatus/map.js +8 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/elementsBySubscription/map.js +6 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/elementsByWorkflow/map.js +8 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/elementsByWorkflow/reduce.js +3 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/elementsDetailByWorkflowAndStatus/map.js +26 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/jobInjectStatusByRequest/map.js +10 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/jobInjectStatusByRequest/reduce.js +1 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/jobStatusByRequest/map.js +6 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/jobStatusByRequest/reduce.js +1 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/jobsByChildQueueAndPriority/map.js +6 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/jobsByChildQueueAndPriority/reduce.js +1 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/jobsByChildQueueAndStatus/map.js +6 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/jobsByChildQueueAndStatus/reduce.js +1 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/jobsByRequest/map.js +6 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/jobsByRequest/reduce.js +1 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/jobsByStatus/map.js +6 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/jobsByStatus/reduce.js +1 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/jobsByStatusAndPriority/map.js +6 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/jobsByStatusAndPriority/reduce.js +1 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/openRequests/map.js +6 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/recent-items/map.js +5 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/siteWhitelistByRequest/map.js +6 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/siteWhitelistByRequest/reduce.js +1 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/specsByWorkflow/map.js +5 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/stuckElements/map.js +38 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/wmbsInjectStatusByRequest/map.js +12 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/wmbsInjectStatusByRequest/reduce.js +3 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/wmbsUrl/map.js +6 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/wmbsUrl/reduce.js +2 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/wmbsUrlByRequest/map.js +6 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/wmbsUrlByRequest/reduce.js +2 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/workflowSummary/map.js +9 -0
- wmglobalqueue-2.4.5.1.data/data/data/couchapps/WorkQueue/views/workflowSummary/reduce.js +10 -0
- wmglobalqueue-2.4.5.1.dist-info/METADATA +26 -0
- wmglobalqueue-2.4.5.1.dist-info/RECORD +347 -0
- wmglobalqueue-2.4.5.1.dist-info/WHEEL +5 -0
- wmglobalqueue-2.4.5.1.dist-info/licenses/LICENSE +202 -0
- wmglobalqueue-2.4.5.1.dist-info/licenses/NOTICE +16 -0
- wmglobalqueue-2.4.5.1.dist-info/top_level.txt +2 -0
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# -*- coding: ISO-8859-1 -*-
|
|
3
|
+
# pylint: disable=E1101,C0103,R0902,E0602
|
|
4
|
+
# E0602: sneakily importing a lot of stuff, turn off for false positives
|
|
5
|
+
|
|
6
|
+
"""
|
|
7
|
+
Couch DB command line admin tool
|
|
8
|
+
"""
|
|
9
|
+
from __future__ import print_function
|
|
10
|
+
from future import standard_library
|
|
11
|
+
standard_library.install_aliases()
|
|
12
|
+
|
|
13
|
+
import urllib.parse
|
|
14
|
+
|
|
15
|
+
__license__ = "GPL"
|
|
16
|
+
__maintainer__ = "Valentin Kuznetsov"
|
|
17
|
+
__email__ = "vkuznet@gmail.com"
|
|
18
|
+
__status__ = "Alpha"
|
|
19
|
+
|
|
20
|
+
# system modules
|
|
21
|
+
import os
|
|
22
|
+
import sys
|
|
23
|
+
import inspect
|
|
24
|
+
import traceback
|
|
25
|
+
|
|
26
|
+
# ipython modules
|
|
27
|
+
from IPython import Release
|
|
28
|
+
import IPython.ipapi
|
|
29
|
+
import __main__
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class PrintManager:
|
|
33
|
+
def __init__(self):
|
|
34
|
+
from IPython import ColorANSI
|
|
35
|
+
self.term = ColorANSI.TermColors
|
|
36
|
+
|
|
37
|
+
def print_red(self, msg):
|
|
38
|
+
"""print message using red color"""
|
|
39
|
+
print(self.msg_red(msg))
|
|
40
|
+
|
|
41
|
+
def print_green(self, msg):
|
|
42
|
+
"""print message using blue color"""
|
|
43
|
+
print(self.msg_green(msg))
|
|
44
|
+
|
|
45
|
+
def print_blue(self, msg):
|
|
46
|
+
"""print message using blue color"""
|
|
47
|
+
print(self.msg_blue(msg))
|
|
48
|
+
|
|
49
|
+
def msg_red(self, msg):
|
|
50
|
+
"""yield message using red color"""
|
|
51
|
+
if not msg:
|
|
52
|
+
msg = ''
|
|
53
|
+
return self.term.Red + msg + self.term.Black
|
|
54
|
+
|
|
55
|
+
def msg_green(self, msg):
|
|
56
|
+
"""yield message using green color"""
|
|
57
|
+
if not msg:
|
|
58
|
+
msg = ''
|
|
59
|
+
return self.term.Green + msg + self.term.Black
|
|
60
|
+
|
|
61
|
+
def msg_blue(self, msg):
|
|
62
|
+
"""yield message using blue color"""
|
|
63
|
+
if not msg:
|
|
64
|
+
msg = ''
|
|
65
|
+
return self.term.Blue + msg + self.term.Black
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def load_config(func_list=[]):
|
|
69
|
+
"""
|
|
70
|
+
Defines default configuration for Couch DB. We need the following:
|
|
71
|
+
URI - the Couch DB URI
|
|
72
|
+
DB - the Couch DB name
|
|
73
|
+
DESIGN - the Couch DB design name
|
|
74
|
+
DEBUG - debug level, used to setup HTTPConnection debug level
|
|
75
|
+
"""
|
|
76
|
+
msg = """
|
|
77
|
+
import os, re, sys, time, types, traceback, inspect
|
|
78
|
+
import urllib, urllib2, httplib
|
|
79
|
+
import json
|
|
80
|
+
from json import JSONDecoder, JSONEncoder
|
|
81
|
+
try:
|
|
82
|
+
from path import path
|
|
83
|
+
except ImportError:
|
|
84
|
+
pass
|
|
85
|
+
try:
|
|
86
|
+
from ipipe import *
|
|
87
|
+
except ImportError:
|
|
88
|
+
pass
|
|
89
|
+
|
|
90
|
+
# global variables
|
|
91
|
+
URI="http://localhost:5984"
|
|
92
|
+
DB="das"
|
|
93
|
+
DESIGN="dasadmin"
|
|
94
|
+
DEBUG=0
|
|
95
|
+
"""
|
|
96
|
+
msg += "\n%s\n" % inspect.getsource(PrintManager)
|
|
97
|
+
msg += "PM = PrintManager()"
|
|
98
|
+
for func in func_list:
|
|
99
|
+
msg += "\n%s\n" % inspect.getsource(func)
|
|
100
|
+
return msg
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def httplib_request(host, path, params, request='POST', debug=0):
|
|
104
|
+
"""request method using provided HTTP request and httplib library"""
|
|
105
|
+
if debug:
|
|
106
|
+
httplib.HTTPConnection.debuglevel = 1
|
|
107
|
+
if not isinstance(params, str):
|
|
108
|
+
params = urllib.parse.urlencode(params, doseq=True)
|
|
109
|
+
if debug:
|
|
110
|
+
print("input parameters", params)
|
|
111
|
+
headers = {"Content-type": "application/x-www-form-urlencoded",
|
|
112
|
+
"Accept": "text/plain"}
|
|
113
|
+
if host.find('https://') != -1:
|
|
114
|
+
host = host.replace('https://', '')
|
|
115
|
+
conn = httplib.HTTPSConnection(host)
|
|
116
|
+
else:
|
|
117
|
+
host = host.replace('http://', '')
|
|
118
|
+
conn = httplib.HTTPConnection(host)
|
|
119
|
+
if request == 'GET':
|
|
120
|
+
conn.request(request, path)
|
|
121
|
+
else:
|
|
122
|
+
conn.request(request, path, params, headers)
|
|
123
|
+
response = conn.getresponse()
|
|
124
|
+
|
|
125
|
+
if response.reason != "OK":
|
|
126
|
+
print(response.status, response.reason, response.read())
|
|
127
|
+
res = None
|
|
128
|
+
else:
|
|
129
|
+
res = response.read()
|
|
130
|
+
conn.close()
|
|
131
|
+
return res
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def print_data(data, lookup="value"):
|
|
135
|
+
"""
|
|
136
|
+
Provides pretty print of json data based on lookup parameter
|
|
137
|
+
by default lookup=value. See couch db response for more info.
|
|
138
|
+
"""
|
|
139
|
+
jsondict = json.loads(data)
|
|
140
|
+
PM.print_blue("Total %s documents" % len(jsondict['rows']))
|
|
141
|
+
maxl = 0
|
|
142
|
+
padding = ""
|
|
143
|
+
for row in jsondict['rows']:
|
|
144
|
+
values = row[lookup]
|
|
145
|
+
if isinstance(values, dict):
|
|
146
|
+
if not padding:
|
|
147
|
+
for key in values.keys():
|
|
148
|
+
if len(key) > maxl:
|
|
149
|
+
maxl = len(key)
|
|
150
|
+
for key, val in values.items():
|
|
151
|
+
padding = " " * (maxl - len(key))
|
|
152
|
+
print("%s%s: %s" % (padding, PM.msg_blue(key), val))
|
|
153
|
+
print()
|
|
154
|
+
else:
|
|
155
|
+
print(values)
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def set_prompt(in1):
|
|
159
|
+
"""Define shell prompt"""
|
|
160
|
+
if in1.find('|\#>') != -1:
|
|
161
|
+
in1 = in1.replace('|\#>', '').strip()
|
|
162
|
+
ip = __main__.__dict__['__IP']
|
|
163
|
+
prompt = getattr(ip.outputcache, 'prompt1')
|
|
164
|
+
prompt.p_template = in1 + " |\#> "
|
|
165
|
+
prompt.set_p_str()
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def couch_help(self, arg):
|
|
169
|
+
"""
|
|
170
|
+
Provide simple help about available commands
|
|
171
|
+
"""
|
|
172
|
+
pmgr = PrintManager()
|
|
173
|
+
global magic_list
|
|
174
|
+
msg = "\nAvailable commands:\n"
|
|
175
|
+
for name, func in magic_list:
|
|
176
|
+
msg += "%s\n%s\n" % (pmgr.msg_blue(name), pmgr.msg_green(func.__doc__))
|
|
177
|
+
msg += "List of pre-defined variables to control your interactions "
|
|
178
|
+
msg += "with CouchDB:\n"
|
|
179
|
+
msg += pmgr.msg_green(" URI, DB, DESIGN, DEBUG\n")
|
|
180
|
+
print(msg)
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
### MAGIC COMMANDS ###
|
|
184
|
+
def db_info():
|
|
185
|
+
"""
|
|
186
|
+
Provide information about Couch DB. Use DB parameter to setup
|
|
187
|
+
your couch DB name.
|
|
188
|
+
"""
|
|
189
|
+
host = URI
|
|
190
|
+
path = '/%s' % DB
|
|
191
|
+
data = httplib_request(host, path, {}, 'GET', DEBUG)
|
|
192
|
+
if not data:
|
|
193
|
+
return data
|
|
194
|
+
return json.loads(data)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def couch_views():
|
|
198
|
+
"""
|
|
199
|
+
List registered views in couch db.
|
|
200
|
+
"""
|
|
201
|
+
qqq = 'startkey=%22_design%2F%22&endkey=%22_design0%22'
|
|
202
|
+
host = URI
|
|
203
|
+
path = '/%s/_all_docs?%s' % (DB, qqq)
|
|
204
|
+
results = httplib_request(host, path, {}, 'GET', DEBUG)
|
|
205
|
+
designdocs = json.loads(results)
|
|
206
|
+
results = {}
|
|
207
|
+
for item in designdocs['rows']:
|
|
208
|
+
doc = item['key']
|
|
209
|
+
print(PM.msg_blue("design: ") + doc)
|
|
210
|
+
path = '/%s/%s' % (DB, doc)
|
|
211
|
+
res = httplib_request(host, path, {}, 'GET', DEBUG)
|
|
212
|
+
rdict = json.loads(res)
|
|
213
|
+
for view_name, view_dict in rdict['views'].items():
|
|
214
|
+
print(PM.msg_blue("view name: ") + view_name)
|
|
215
|
+
print(PM.msg_blue("map:"))
|
|
216
|
+
print(PM.msg_green(view_dict['map']))
|
|
217
|
+
if 'reduce' in view_dict:
|
|
218
|
+
print(PM.msg_blue("reduce:"))
|
|
219
|
+
print(PM.msg_green(view_dict['reduce']))
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def create_view(view_dict):
|
|
223
|
+
"""
|
|
224
|
+
Create couch db view. The db and design names are controlled via
|
|
225
|
+
DB and DESIGN shell parameters, respectively.
|
|
226
|
+
Parameters: <view_dict>
|
|
227
|
+
Example of the view:
|
|
228
|
+
{"view_name": {"map" : "function(doc) { if(doc.hash) {emit(1, doc.hash);}}" }}
|
|
229
|
+
"""
|
|
230
|
+
# get existing views
|
|
231
|
+
host = URI
|
|
232
|
+
path = '/%s/_design/%s' % (DB, DESIGN)
|
|
233
|
+
data = httplib_request(host, path, {}, 'GET', DEBUG)
|
|
234
|
+
jsondict = json.loads(data)
|
|
235
|
+
for view_name, view_def in view_dict.items():
|
|
236
|
+
jsondict['views'][view_name] = view_def
|
|
237
|
+
|
|
238
|
+
# update views
|
|
239
|
+
encoder = JSONEncoder()
|
|
240
|
+
params = encoder.encode(jsondict)
|
|
241
|
+
request = 'PUT'
|
|
242
|
+
debug = DEBUG
|
|
243
|
+
data = httplib_request(host, path, params, request, debug)
|
|
244
|
+
if not data:
|
|
245
|
+
return data
|
|
246
|
+
return json.loads(data)
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
def delete_view(view_name):
|
|
250
|
+
"""
|
|
251
|
+
Delete couch db view. The db and design names are controlled via
|
|
252
|
+
DB and DESIGN shell parameters, respectively.
|
|
253
|
+
Parameters: <view_name>
|
|
254
|
+
"""
|
|
255
|
+
# get existing views
|
|
256
|
+
host = URI
|
|
257
|
+
path = '/%s/_design/%s' % (DB, DESIGN)
|
|
258
|
+
data = httplib_request(host, path, {}, 'GET', DEBUG)
|
|
259
|
+
if not data:
|
|
260
|
+
return data
|
|
261
|
+
jsondict = json.loads(data)
|
|
262
|
+
|
|
263
|
+
# delete requested view in view dict document
|
|
264
|
+
try:
|
|
265
|
+
del jsondict['views'][view_name]
|
|
266
|
+
# update view dict document in a couch
|
|
267
|
+
encoder = JSONEncoder()
|
|
268
|
+
params = encoder.encode(jsondict)
|
|
269
|
+
request = 'PUT'
|
|
270
|
+
debug = DEBUG
|
|
271
|
+
data = httplib_request(host, path, params, request, debug)
|
|
272
|
+
except:
|
|
273
|
+
traceback.print_exc()
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
def delete_all_views(design):
|
|
277
|
+
"""
|
|
278
|
+
Delete all views in particular design document.
|
|
279
|
+
The db and design names are controlled via
|
|
280
|
+
DB and DESIGN shell parameters, respectively.
|
|
281
|
+
Parameters: <design_name, e.g. dasadmin>
|
|
282
|
+
"""
|
|
283
|
+
host = URI
|
|
284
|
+
path = '/%s/_design/%s' % (DB, design)
|
|
285
|
+
data = httplib_request(host, path, {}, 'DELETE', DEBUG)
|
|
286
|
+
if not data:
|
|
287
|
+
return data
|
|
288
|
+
return json.loads(data)
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
def create_db(db_name):
|
|
292
|
+
"""
|
|
293
|
+
Create a new DB in couch.
|
|
294
|
+
Parameters: <db_name>
|
|
295
|
+
"""
|
|
296
|
+
host = URI
|
|
297
|
+
path = '/%s' % db_name
|
|
298
|
+
data = httplib_request(host, path, {}, 'PUT', DEBUG)
|
|
299
|
+
if not data:
|
|
300
|
+
return data
|
|
301
|
+
return json.loads(data)
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
def delete_db(db_name):
|
|
305
|
+
"""
|
|
306
|
+
Delete DB in couch.
|
|
307
|
+
Parameters: <db_name>
|
|
308
|
+
"""
|
|
309
|
+
host = URI
|
|
310
|
+
path = '/%s' % db_name
|
|
311
|
+
data = httplib_request(host, path, {}, 'DELETE', DEBUG)
|
|
312
|
+
if not data:
|
|
313
|
+
return data
|
|
314
|
+
return json.loads(data)
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
def get_all_docs(idx=0, limit=0, pretty_print=False):
|
|
318
|
+
"""
|
|
319
|
+
Retrieve all documents from CouchDB.
|
|
320
|
+
Parameters: <idx=0> <limit=0> <pretty_print=False>
|
|
321
|
+
"""
|
|
322
|
+
host = URI
|
|
323
|
+
path = '/%s/_all_docs' % DB
|
|
324
|
+
kwds = {}
|
|
325
|
+
if idx:
|
|
326
|
+
kwds['skip'] = idx
|
|
327
|
+
if limit:
|
|
328
|
+
kwds['limit'] = limit
|
|
329
|
+
data = httplib_request(host, path, kwds, 'GET', DEBUG)
|
|
330
|
+
if not data:
|
|
331
|
+
return data
|
|
332
|
+
if pretty_print:
|
|
333
|
+
print_data(data, lookup='id')
|
|
334
|
+
else:
|
|
335
|
+
return json.loads(data)
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
def get_doc(id):
|
|
339
|
+
"""
|
|
340
|
+
Retrieve document with given id from CouchDB.
|
|
341
|
+
Parameters: <id, e.g. 1323764f7a6af1b37b72119920cbaa08>
|
|
342
|
+
"""
|
|
343
|
+
host = URI
|
|
344
|
+
path = '/%s/%s' % (DB, id)
|
|
345
|
+
kwds = {}
|
|
346
|
+
data = httplib_request(host, path, kwds, 'GET', DEBUG)
|
|
347
|
+
if not data:
|
|
348
|
+
return data
|
|
349
|
+
return json.loads(data)
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
def load_module(arg):
|
|
353
|
+
"""
|
|
354
|
+
Load custom admin module. Name it as <module>_ipython.py and place in
|
|
355
|
+
your PYTHONPATH. Implement a <module>_load() function to load your stuff.
|
|
356
|
+
Parameters: <module>
|
|
357
|
+
|
|
358
|
+
Example:
|
|
359
|
+
def mycmd():
|
|
360
|
+
pass # do something here
|
|
361
|
+
def mymodule_load():
|
|
362
|
+
ip = IPython.ipapi.get()
|
|
363
|
+
ip.expose_magic('mycmd', mycmd)
|
|
364
|
+
"""
|
|
365
|
+
# try to load custom modules
|
|
366
|
+
stm = "from %s_ipython import %s_load\n" % (arg, arg)
|
|
367
|
+
stm += "%s_load()" % arg
|
|
368
|
+
obj = compile(str(stm), '<string>', 'exec')
|
|
369
|
+
try:
|
|
370
|
+
eval(obj)
|
|
371
|
+
msg = "Loaded %s module. " % arg
|
|
372
|
+
msg += "Use " + PM.msg_blue("%s_help" % arg) + \
|
|
373
|
+
" for concrete module help if it's implemented"
|
|
374
|
+
print(msg)
|
|
375
|
+
except:
|
|
376
|
+
traceback.print_exc()
|
|
377
|
+
pass
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
# keep magic list as global since it's used in couch_help
|
|
381
|
+
magic_list = [
|
|
382
|
+
('db_info', db_info),
|
|
383
|
+
('couch_views', couch_views),
|
|
384
|
+
('create_view', create_view),
|
|
385
|
+
('delete_view', delete_view),
|
|
386
|
+
('delete_all_views', delete_all_views),
|
|
387
|
+
('get_all_docs', get_all_docs),
|
|
388
|
+
('get_doc', get_doc),
|
|
389
|
+
('create_db', create_db),
|
|
390
|
+
('delete_db', delete_db),
|
|
391
|
+
('load_module', load_module),
|
|
392
|
+
]
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
def main():
|
|
396
|
+
"""
|
|
397
|
+
Main function which defint ipython behavior
|
|
398
|
+
"""
|
|
399
|
+
pmgr = PrintManager()
|
|
400
|
+
|
|
401
|
+
# global IP API
|
|
402
|
+
ip = IPython.ipapi.get()
|
|
403
|
+
|
|
404
|
+
o = ip.options
|
|
405
|
+
ip.expose_magic('couch_help', couch_help)
|
|
406
|
+
# load commands and expose them to the shell
|
|
407
|
+
for m in magic_list:
|
|
408
|
+
ip.ex(inspect.getsource(m[1]))
|
|
409
|
+
|
|
410
|
+
# load configuration for couch-sh, supply a names of functions to
|
|
411
|
+
# be loaded
|
|
412
|
+
ip.ex(load_config([httplib_request, print_data]))
|
|
413
|
+
|
|
414
|
+
# autocall to "full" mode (smart mode is default, I like full mode)
|
|
415
|
+
o.autocall = 2
|
|
416
|
+
|
|
417
|
+
# Set dbsh prompt
|
|
418
|
+
o.prompt_in1 = 'couch-sh |\#> '
|
|
419
|
+
o.prompt_in2 = 'couch-sh> '
|
|
420
|
+
o.system_verbose = 0
|
|
421
|
+
|
|
422
|
+
# define couch-sh banner
|
|
423
|
+
pyver = sys.version.split('\n')[0]
|
|
424
|
+
ipyver = Release.version
|
|
425
|
+
msg = "Welcome to couch-sh \n[python %s, ipython %s]\n%s\n" \
|
|
426
|
+
% (pyver, ipyver, os.uname()[3])
|
|
427
|
+
msg += "For couch-sh help use "
|
|
428
|
+
msg += pmgr.msg_blue("couch_help")
|
|
429
|
+
msg += ", for python help use help commands\n"
|
|
430
|
+
o.banner = msg
|
|
431
|
+
o.prompts_pad_left = "1"
|
|
432
|
+
# Remove all blank lines in between prompts, like a normal shell.
|
|
433
|
+
o.separate_in = "0"
|
|
434
|
+
o.separate_out = "0"
|
|
435
|
+
o.separate_out2 = "0"
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
main()
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from __future__ import (division, print_function)
|
|
2
|
+
|
|
3
|
+
from time import time
|
|
4
|
+
from WMCore.REST.CherryPyPeriodicTask import CherryPyPeriodicTask
|
|
5
|
+
from WMCore.WorkQueue.WorkQueue import globalQueue
|
|
6
|
+
|
|
7
|
+
class CleanUpTask(CherryPyPeriodicTask):
|
|
8
|
+
|
|
9
|
+
def __init__(self, rest, config):
|
|
10
|
+
|
|
11
|
+
super(CleanUpTask, self).__init__(config)
|
|
12
|
+
self.globalQ = globalQueue(logger=self.logger, **config.queueParams)
|
|
13
|
+
|
|
14
|
+
def setConcurrentTasks(self, config):
|
|
15
|
+
"""
|
|
16
|
+
sets the list of function reference for concurrent tasks
|
|
17
|
+
"""
|
|
18
|
+
self.concurrentTasks = [{'func': self.cleanUpAndSyncCanceledElements, 'duration': config.cleanUpDuration}]
|
|
19
|
+
|
|
20
|
+
def cleanUpAndSyncCanceledElements(self, config):
|
|
21
|
+
"""
|
|
22
|
+
1. deleted the wqe in end states
|
|
23
|
+
2. synchronize cancelled elements.
|
|
24
|
+
We can also make this in the separate thread
|
|
25
|
+
"""
|
|
26
|
+
tStart = time()
|
|
27
|
+
self.globalQ.performQueueCleanupActions(skipWMBS=True)
|
|
28
|
+
self.logger.info("%s executed in %.3f secs.", self.__class__.__name__, time() - tStart)
|
|
29
|
+
return
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
from __future__ import (division, print_function)
|
|
2
|
+
|
|
3
|
+
from future.utils import viewitems
|
|
4
|
+
|
|
5
|
+
from time import time
|
|
6
|
+
from WMCore.REST.HeartbeatMonitorBase import HeartbeatMonitorBase
|
|
7
|
+
from WMCore.WorkQueue.WorkQueue import globalQueue
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class HeartbeatMonitor(HeartbeatMonitorBase):
|
|
11
|
+
def __init__(self, rest, config):
|
|
12
|
+
super(HeartbeatMonitor, self).__init__(rest, config)
|
|
13
|
+
self.initialStatus = ['Available', 'Negotiating', 'Acquired']
|
|
14
|
+
self.producer = "global_workqueue"
|
|
15
|
+
self.docTypeAMQ = "cms_%s_info" % self.producer
|
|
16
|
+
self.globalQ = globalQueue(logger=self.logger, **config.queueParams)
|
|
17
|
+
|
|
18
|
+
def addAdditionalMonitorReport(self, config):
|
|
19
|
+
"""
|
|
20
|
+
Collect some statistics for Global Workqueue and upload it to WMStats and
|
|
21
|
+
MonIT.
|
|
22
|
+
"""
|
|
23
|
+
tStart = time()
|
|
24
|
+
self.logger.info("Collecting GlobalWorkqueue statistics...")
|
|
25
|
+
|
|
26
|
+
# retrieve whole docs for these status in order to create site metrics
|
|
27
|
+
results = self.globalQ.monitorWorkQueue(self.initialStatus)
|
|
28
|
+
|
|
29
|
+
if self.postToAMQ:
|
|
30
|
+
allDocs = self.buildMonITDocs(results)
|
|
31
|
+
self.uploadToAMQ(allDocs)
|
|
32
|
+
self.logger.info("%s executed in %.3f secs.", self.__class__.__name__, time() - tStart)
|
|
33
|
+
|
|
34
|
+
return results
|
|
35
|
+
|
|
36
|
+
def buildMonITDocs(self, stats):
|
|
37
|
+
"""
|
|
38
|
+
Given the statistics that are uploaded to wmstats, create different
|
|
39
|
+
documents to post to MonIT AMQ (aggregation-friendly docs).
|
|
40
|
+
"""
|
|
41
|
+
mapMetricToType = {'uniqueJobsPerSite': 'work_site_unique', # respecting data location constraints
|
|
42
|
+
'possibleJobsPerSite': 'work_site_possible',
|
|
43
|
+
'uniqueJobsPerSiteAAA': 'work_site_uniqueAAA', # assume work can run anywhere
|
|
44
|
+
'possibleJobsPerSiteAAA': 'work_site_possibleAAA'}
|
|
45
|
+
commonInfo = {"agent_url": "global_workqueue"}
|
|
46
|
+
|
|
47
|
+
docs = []
|
|
48
|
+
for status, data in viewitems(stats['workByStatus']):
|
|
49
|
+
doc = dict()
|
|
50
|
+
doc["type"] = "work_info"
|
|
51
|
+
doc["status"] = status
|
|
52
|
+
doc["num_elem"] = data.get('num_elem', 0) # total number of workqueue elements
|
|
53
|
+
doc["sum_jobs"] = data.get('sum_jobs', 0) # total number of top level jobs
|
|
54
|
+
doc["max_jobs_elem"] = data.get('max_jobs_elem', 0) # largest # of jobs found in a WQE
|
|
55
|
+
docs.append(doc)
|
|
56
|
+
|
|
57
|
+
for status, data in viewitems(stats['workByStatusAndPriority']):
|
|
58
|
+
for item in data:
|
|
59
|
+
doc = dict()
|
|
60
|
+
doc["type"] = "work_prio_status"
|
|
61
|
+
doc["status"] = status
|
|
62
|
+
doc.update(item)
|
|
63
|
+
docs.append(doc)
|
|
64
|
+
|
|
65
|
+
for item in stats['workByAgentAndStatus']:
|
|
66
|
+
doc = dict()
|
|
67
|
+
doc["type"] = "work_agent_status"
|
|
68
|
+
doc["status"] = item['status']
|
|
69
|
+
doc["agent_name"] = item['agent_name']
|
|
70
|
+
doc["num_elem"] = item['num_elem'] # total number of workqueue elements
|
|
71
|
+
doc["sum_jobs"] = item['sum_jobs'] # total number of top level jobs
|
|
72
|
+
doc["max_jobs_elem"] = item['max_jobs_elem'] # largest # of jobs found in a WQE
|
|
73
|
+
docs.append(doc)
|
|
74
|
+
|
|
75
|
+
for item in stats['workByAgentAndPriority']:
|
|
76
|
+
doc = dict()
|
|
77
|
+
doc["type"] = "work_agent_prio"
|
|
78
|
+
doc["priority"] = item['priority']
|
|
79
|
+
doc["agent_name"] = item['agent_name']
|
|
80
|
+
doc["num_elem"] = item['num_elem'] # total number of workqueue elements
|
|
81
|
+
doc["sum_jobs"] = item['sum_jobs'] # total number of top level jobs
|
|
82
|
+
doc["max_jobs_elem"] = item['max_jobs_elem'] # largest # of jobs found in a WQE
|
|
83
|
+
docs.append(doc)
|
|
84
|
+
|
|
85
|
+
# let's remap Jobs --> sum_jobs , and NumElems --> num_elem
|
|
86
|
+
for metric in mapMetricToType:
|
|
87
|
+
for status, sites in viewitems(stats[metric]):
|
|
88
|
+
if not sites:
|
|
89
|
+
# no work in this status available for any sites, skip!
|
|
90
|
+
continue
|
|
91
|
+
for site in sites:
|
|
92
|
+
doc = dict()
|
|
93
|
+
doc["type"] = mapMetricToType[metric]
|
|
94
|
+
doc["status"] = status
|
|
95
|
+
doc["site_name"] = site
|
|
96
|
+
doc['num_elem'] = sites[site]['num_elem']
|
|
97
|
+
doc['sum_jobs'] = int(sites[site]['sum_jobs'])
|
|
98
|
+
docs.append(doc)
|
|
99
|
+
|
|
100
|
+
# mark every single document as being from global_workqueue
|
|
101
|
+
for doc in docs:
|
|
102
|
+
doc.update(commonInfo)
|
|
103
|
+
|
|
104
|
+
self.logger.info("%i docs created to post to MonIT", len(docs))
|
|
105
|
+
return docs
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from __future__ import (division, print_function)
|
|
2
|
+
from time import time
|
|
3
|
+
from WMCore.REST.CherryPyPeriodicTask import CherryPyPeriodicTask
|
|
4
|
+
from WMCore.WorkQueue.WorkQueue import globalQueue
|
|
5
|
+
|
|
6
|
+
class LocationUpdateTask(CherryPyPeriodicTask):
|
|
7
|
+
|
|
8
|
+
def __init__(self, rest, config):
|
|
9
|
+
|
|
10
|
+
super(LocationUpdateTask, self).__init__(config)
|
|
11
|
+
self.globalQ = globalQueue(logger=self.logger, **config.queueParams)
|
|
12
|
+
|
|
13
|
+
def setConcurrentTasks(self, config):
|
|
14
|
+
"""
|
|
15
|
+
sets the list of function reference for concurrent tasks
|
|
16
|
+
"""
|
|
17
|
+
self.concurrentTasks = [{'func': self.updateDataLocation, 'duration': config.locationUpdateDuration}]
|
|
18
|
+
|
|
19
|
+
def updateDataLocation(self, config):
|
|
20
|
+
"""
|
|
21
|
+
gather active data statistics
|
|
22
|
+
"""
|
|
23
|
+
tStart = time()
|
|
24
|
+
res = self.globalQ.updateLocationInfo()
|
|
25
|
+
self.logger.info("%s executed in %.3f secs and updated %d non-unique elements",
|
|
26
|
+
self.__class__.__name__, time() - tStart, res)
|
|
27
|
+
|
|
28
|
+
return
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from __future__ import (division, print_function)
|
|
2
|
+
|
|
3
|
+
from time import time
|
|
4
|
+
|
|
5
|
+
from WMCore.REST.CherryPyPeriodicTask import CherryPyPeriodicTask
|
|
6
|
+
from WMCore.WorkQueue.WorkQueue import globalQueue
|
|
7
|
+
from WMCore.WorkQueue.WorkQueueReqMgrInterface import WorkQueueReqMgrInterface
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ReqMgrInteractionTask(CherryPyPeriodicTask):
|
|
11
|
+
|
|
12
|
+
def __init__(self, rest, config):
|
|
13
|
+
super(ReqMgrInteractionTask, self).__init__(config)
|
|
14
|
+
self.globalQ = globalQueue(logger=self.logger, **config.queueParams)
|
|
15
|
+
self.reqMgrInt = WorkQueueReqMgrInterface(logger=self.logger, **config.reqMgrConfig)
|
|
16
|
+
|
|
17
|
+
def setConcurrentTasks(self, config):
|
|
18
|
+
"""
|
|
19
|
+
sets the list of function reference for concurrent tasks
|
|
20
|
+
"""
|
|
21
|
+
self.concurrentTasks = [{'func': self.interactWithReqmgr, 'duration': config.interactDuration}]
|
|
22
|
+
|
|
23
|
+
def interactWithReqmgr(self, config):
|
|
24
|
+
"""
|
|
25
|
+
1. pull new work
|
|
26
|
+
2. add the new element from running-open request
|
|
27
|
+
3. report element status to reqmgr (need to be removed and set as reqmgr task)
|
|
28
|
+
4. record this activity
|
|
29
|
+
"""
|
|
30
|
+
tStart = time()
|
|
31
|
+
self.logger.info("Executing WorkQueue/ReqMgr thread")
|
|
32
|
+
self.reqMgrInt(self.globalQ)
|
|
33
|
+
self.logger.info("%s executed in %.3f secs.\n", self.__class__.__name__, time() - tStart)
|
|
34
|
+
|
|
35
|
+
return
|
|
File without changes
|
|
File without changes
|