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
Utils/TwPrint.py
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
"""
|
|
3
|
+
File : TwPrint.py
|
|
4
|
+
|
|
5
|
+
Description:
|
|
6
|
+
|
|
7
|
+
A simple textwrap based printer for nested dictionaries.
|
|
8
|
+
|
|
9
|
+
"""
|
|
10
|
+
from textwrap import TextWrapper
|
|
11
|
+
from collections import OrderedDict
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def twClosure(replace_whitespace=False,
|
|
15
|
+
break_long_words=False,
|
|
16
|
+
maxWidth=120,
|
|
17
|
+
maxLength=-1,
|
|
18
|
+
maxDepth=-1,
|
|
19
|
+
initial_indent=''):
|
|
20
|
+
"""
|
|
21
|
+
Deals with indentation of dictionaries with very long key, value pairs.
|
|
22
|
+
replace_whitespace: Replace each whitespace character with a single space.
|
|
23
|
+
break_long_words: If True words longer than width will be broken.
|
|
24
|
+
width: The maximum length of wrapped lines.
|
|
25
|
+
initial_indent: String that will be prepended to the first line of the output
|
|
26
|
+
|
|
27
|
+
Wraps all strings for both keys and values to 120 chars.
|
|
28
|
+
Uses 4 spaces indentation for both keys and values.
|
|
29
|
+
Nested dictionaries and lists go to next line.
|
|
30
|
+
"""
|
|
31
|
+
twr = TextWrapper(replace_whitespace=replace_whitespace,
|
|
32
|
+
break_long_words=break_long_words,
|
|
33
|
+
width=maxWidth,
|
|
34
|
+
initial_indent=initial_indent)
|
|
35
|
+
|
|
36
|
+
def twEnclosed(obj, ind='', depthReached=0, reCall=False):
|
|
37
|
+
"""
|
|
38
|
+
The inner function of the closure
|
|
39
|
+
ind: Initial indentation for the single output string
|
|
40
|
+
reCall: Flag to indicate a recursive call (should not be used outside)
|
|
41
|
+
"""
|
|
42
|
+
output = ''
|
|
43
|
+
if isinstance(obj, dict):
|
|
44
|
+
obj = OrderedDict(sorted(list(obj.items()),
|
|
45
|
+
key=lambda t: t[0],
|
|
46
|
+
reverse=False))
|
|
47
|
+
if reCall:
|
|
48
|
+
output += '\n'
|
|
49
|
+
ind += ' '
|
|
50
|
+
depthReached += 1
|
|
51
|
+
lengthReached = 0
|
|
52
|
+
for key, value in list(obj.items()):
|
|
53
|
+
lengthReached += 1
|
|
54
|
+
if lengthReached > maxLength and maxLength >= 0:
|
|
55
|
+
output += "%s...\n" % ind
|
|
56
|
+
break
|
|
57
|
+
if depthReached <= maxDepth or maxDepth < 0:
|
|
58
|
+
output += "%s%s: %s" % (ind,
|
|
59
|
+
''.join(twr.wrap(key)),
|
|
60
|
+
twEnclosed(value, ind, depthReached=depthReached, reCall=True))
|
|
61
|
+
|
|
62
|
+
elif isinstance(obj, (list, set)):
|
|
63
|
+
if reCall:
|
|
64
|
+
output += '\n'
|
|
65
|
+
ind += ' '
|
|
66
|
+
lengthReached = 0
|
|
67
|
+
for value in obj:
|
|
68
|
+
lengthReached += 1
|
|
69
|
+
if lengthReached > maxLength and maxLength >= 0:
|
|
70
|
+
output += "%s...\n" % ind
|
|
71
|
+
break
|
|
72
|
+
if depthReached <= maxDepth or maxDepth < 0:
|
|
73
|
+
output += "%s%s" % (ind, twEnclosed(value, ind, depthReached=depthReached, reCall=True))
|
|
74
|
+
else:
|
|
75
|
+
output += "%s\n" % str(obj) # join(twr.wrap(str(obj)))
|
|
76
|
+
return output
|
|
77
|
+
|
|
78
|
+
return twEnclosed
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def twPrint(obj, maxWidth=120, maxLength=-1, maxDepth=-1):
|
|
82
|
+
"""
|
|
83
|
+
A simple caller of twClosure (see docstring for twClosure)
|
|
84
|
+
"""
|
|
85
|
+
twPrinter = twClosure(maxWidth=maxWidth,
|
|
86
|
+
maxLength=maxLength,
|
|
87
|
+
maxDepth=maxDepth)
|
|
88
|
+
print(twPrinter(obj))
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def twFormat(obj, maxWidth=120, maxLength=-1, maxDepth=-1):
|
|
92
|
+
"""
|
|
93
|
+
A simple caller of twClosure (see docstring for twClosure)
|
|
94
|
+
"""
|
|
95
|
+
twFormatter = twClosure(maxWidth=maxWidth,
|
|
96
|
+
maxLength=maxLength,
|
|
97
|
+
maxDepth=maxDepth)
|
|
98
|
+
return twFormatter(obj)
|
Utils/Utilities.py
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
#! /usr/bin/env python
|
|
2
|
+
|
|
3
|
+
from builtins import str, bytes
|
|
4
|
+
|
|
5
|
+
import subprocess
|
|
6
|
+
import os
|
|
7
|
+
import re
|
|
8
|
+
import zlib
|
|
9
|
+
import base64
|
|
10
|
+
import sys
|
|
11
|
+
from types import ModuleType, FunctionType
|
|
12
|
+
from gc import get_referents
|
|
13
|
+
|
|
14
|
+
def lowerCmsHeaders(headers):
|
|
15
|
+
"""
|
|
16
|
+
Lower CMS headers in provided header's dict. The WMCore Authentication
|
|
17
|
+
code check only cms headers in lower case, e.g. cms-xxx-yyy.
|
|
18
|
+
"""
|
|
19
|
+
lheaders = {}
|
|
20
|
+
for hkey, hval in list(headers.items()): # perform lower-case
|
|
21
|
+
# lower header keys since we check lower-case in headers
|
|
22
|
+
if hkey.startswith('Cms-') or hkey.startswith('CMS-'):
|
|
23
|
+
lheaders[hkey.lower()] = hval
|
|
24
|
+
else:
|
|
25
|
+
lheaders[hkey] = hval
|
|
26
|
+
return lheaders
|
|
27
|
+
|
|
28
|
+
def makeList(stringList):
|
|
29
|
+
"""
|
|
30
|
+
_makeList_
|
|
31
|
+
|
|
32
|
+
Make a python list out of a comma separated list of strings,
|
|
33
|
+
throws a ValueError if the input is not well formed.
|
|
34
|
+
If the stringList is already of type list, then return it untouched.
|
|
35
|
+
"""
|
|
36
|
+
if isinstance(stringList, list):
|
|
37
|
+
return stringList
|
|
38
|
+
if isinstance(stringList, str):
|
|
39
|
+
toks = stringList.lstrip(' [').rstrip(' ]').split(',')
|
|
40
|
+
if toks == ['']:
|
|
41
|
+
return []
|
|
42
|
+
return [str(tok.strip(' \'"')) for tok in toks]
|
|
43
|
+
raise ValueError("Can't convert to list %s" % stringList)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def makeNonEmptyList(stringList):
|
|
47
|
+
"""
|
|
48
|
+
_makeNonEmptyList_
|
|
49
|
+
|
|
50
|
+
Given a string or a list of strings, return a non empty list of strings.
|
|
51
|
+
Throws an exception in case the final list is empty or input data is not
|
|
52
|
+
a string or a python list
|
|
53
|
+
"""
|
|
54
|
+
finalList = makeList(stringList)
|
|
55
|
+
if not finalList:
|
|
56
|
+
raise ValueError("Input data cannot be an empty list %s" % stringList)
|
|
57
|
+
return finalList
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def strToBool(string):
|
|
61
|
+
"""
|
|
62
|
+
Try to convert different variations of True or False (including a string
|
|
63
|
+
type object) to a boolean value.
|
|
64
|
+
In short:
|
|
65
|
+
* True gets mapped from: True, "True", "true", "TRUE".
|
|
66
|
+
* False gets mapped from: False, "False", "false", "FALSE"
|
|
67
|
+
* anything else will fail
|
|
68
|
+
:param string: expects a boolean or a string, but it could be anything else
|
|
69
|
+
:return: a boolean value, or raise an exception if value passed in is not supported
|
|
70
|
+
"""
|
|
71
|
+
if string is False or string is True:
|
|
72
|
+
return string
|
|
73
|
+
elif string in ["True", "true", "TRUE"]:
|
|
74
|
+
return True
|
|
75
|
+
elif string in ["False", "false", "FALSE"]:
|
|
76
|
+
return False
|
|
77
|
+
raise ValueError("Can't convert to bool: %s" % string)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def safeStr(string):
|
|
81
|
+
"""
|
|
82
|
+
_safeStr_
|
|
83
|
+
|
|
84
|
+
Cast simple data (int, float, basestring) to string.
|
|
85
|
+
"""
|
|
86
|
+
if not isinstance(string, (tuple, list, set, dict)):
|
|
87
|
+
return str(string)
|
|
88
|
+
raise ValueError("We're not supposed to convert %s to string." % string)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def diskUse():
|
|
92
|
+
"""
|
|
93
|
+
This returns the % use of each disk partition
|
|
94
|
+
"""
|
|
95
|
+
diskPercent = []
|
|
96
|
+
df = subprocess.Popen(["df", "-klP"], stdout=subprocess.PIPE)
|
|
97
|
+
output = df.communicate()[0]
|
|
98
|
+
output = decodeBytesToUnicode(output).split("\n")
|
|
99
|
+
for x in output:
|
|
100
|
+
split = x.split()
|
|
101
|
+
if split != [] and split[0] != 'Filesystem':
|
|
102
|
+
diskPercent.append({'filesystem': split[0],
|
|
103
|
+
'mounted': split[5],
|
|
104
|
+
'percent': split[4]})
|
|
105
|
+
|
|
106
|
+
return diskPercent
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def numberCouchProcess():
|
|
110
|
+
"""
|
|
111
|
+
This returns the number of couch process
|
|
112
|
+
"""
|
|
113
|
+
ps = subprocess.Popen(["ps", "-ef"], stdout=subprocess.PIPE)
|
|
114
|
+
process = ps.communicate()[0]
|
|
115
|
+
process = decodeBytesToUnicode(process).count('couchjs')
|
|
116
|
+
|
|
117
|
+
return process
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def rootUrlJoin(base, extend):
|
|
121
|
+
"""
|
|
122
|
+
Adds a path element to the path within a ROOT url
|
|
123
|
+
"""
|
|
124
|
+
if base:
|
|
125
|
+
match = re.match("^root://([^/]+)/(.+)", base)
|
|
126
|
+
if match:
|
|
127
|
+
host = match.group(1)
|
|
128
|
+
path = match.group(2)
|
|
129
|
+
newpath = os.path.join(path, extend)
|
|
130
|
+
newurl = "root://%s/%s" % (host, newpath)
|
|
131
|
+
return newurl
|
|
132
|
+
return None
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def zipEncodeStr(message, maxLen=5120, compressLevel=9, steps=100, truncateIndicator=" (...)"):
|
|
136
|
+
"""
|
|
137
|
+
_zipEncodeStr_
|
|
138
|
+
Utility to zip a string and encode it.
|
|
139
|
+
If zipped encoded length is greater than maxLen,
|
|
140
|
+
truncate message until zip/encoded version
|
|
141
|
+
is within the limits allowed.
|
|
142
|
+
"""
|
|
143
|
+
message = encodeUnicodeToBytes(message)
|
|
144
|
+
encodedStr = zlib.compress(message, compressLevel)
|
|
145
|
+
encodedStr = base64.b64encode(encodedStr)
|
|
146
|
+
if len(encodedStr) < maxLen or maxLen == -1:
|
|
147
|
+
return encodedStr
|
|
148
|
+
|
|
149
|
+
compressRate = 1. * len(encodedStr) / len(base64.b64encode(message))
|
|
150
|
+
|
|
151
|
+
# Estimate new length for message zip/encoded version
|
|
152
|
+
# to be less than maxLen.
|
|
153
|
+
# Also, append truncate indicator to message.
|
|
154
|
+
truncateIndicator = encodeUnicodeToBytes(truncateIndicator)
|
|
155
|
+
strLen = int((maxLen - len(truncateIndicator)) / compressRate)
|
|
156
|
+
message = message[:strLen] + truncateIndicator
|
|
157
|
+
|
|
158
|
+
encodedStr = zipEncodeStr(message, maxLen=-1)
|
|
159
|
+
|
|
160
|
+
# If new length is not short enough, truncate
|
|
161
|
+
# recursively by steps
|
|
162
|
+
while len(encodedStr) > maxLen:
|
|
163
|
+
message = message[:-steps - len(truncateIndicator)] + truncateIndicator
|
|
164
|
+
encodedStr = zipEncodeStr(message, maxLen=-1)
|
|
165
|
+
|
|
166
|
+
return encodedStr
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def getSize(obj):
|
|
170
|
+
"""
|
|
171
|
+
_getSize_
|
|
172
|
+
|
|
173
|
+
Function to traverse an object and calculate its total size in bytes
|
|
174
|
+
:param obj: a python object
|
|
175
|
+
:return: an integer representing the total size of the object
|
|
176
|
+
|
|
177
|
+
Code extracted from Stack Overflow:
|
|
178
|
+
https://stackoverflow.com/questions/449560/how-do-i-determine-the-size-of-an-object-in-python
|
|
179
|
+
"""
|
|
180
|
+
# Custom objects know their class.
|
|
181
|
+
# Function objects seem to know way too much, including modules.
|
|
182
|
+
# Exclude modules as well.
|
|
183
|
+
BLACKLIST = type, ModuleType, FunctionType
|
|
184
|
+
|
|
185
|
+
if isinstance(obj, BLACKLIST):
|
|
186
|
+
raise TypeError('getSize() does not take argument of type: '+ str(type(obj)))
|
|
187
|
+
seen_ids = set()
|
|
188
|
+
size = 0
|
|
189
|
+
objects = [obj]
|
|
190
|
+
while objects:
|
|
191
|
+
need_referents = []
|
|
192
|
+
for obj in objects:
|
|
193
|
+
if not isinstance(obj, BLACKLIST) and id(obj) not in seen_ids:
|
|
194
|
+
seen_ids.add(id(obj))
|
|
195
|
+
size += sys.getsizeof(obj)
|
|
196
|
+
need_referents.append(obj)
|
|
197
|
+
objects = get_referents(*need_referents)
|
|
198
|
+
return size
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
def decodeBytesToUnicode(value, errors="strict"):
|
|
202
|
+
"""
|
|
203
|
+
Accepts an input "value" of generic type.
|
|
204
|
+
|
|
205
|
+
If "value" is a string of type sequence of bytes (i.e. in py2 `str` or
|
|
206
|
+
`future.types.newbytes.newbytes`, in py3 `bytes`), then it is converted to
|
|
207
|
+
a sequence of unicode codepoints.
|
|
208
|
+
|
|
209
|
+
This function is useful for cleaning input data when using the
|
|
210
|
+
"unicode sandwich" approach, which involves converting bytes (i.e. strings
|
|
211
|
+
of type sequence of bytes) to unicode (i.e. strings of type sequence of
|
|
212
|
+
unicode codepoints, in py2 `unicode` or `future.types.newstr.newstr`,
|
|
213
|
+
in py3 `str` ) as soon as possible when recieving input data, and
|
|
214
|
+
converting unicode back to bytes as late as possible.
|
|
215
|
+
achtung!:
|
|
216
|
+
- converting unicode back to bytes is not covered by this function
|
|
217
|
+
- converting unicode back to bytes is not always necessary. when in doubt,
|
|
218
|
+
do not do it.
|
|
219
|
+
Reference: https://nedbatchelder.com/text/unipain.html
|
|
220
|
+
|
|
221
|
+
py2:
|
|
222
|
+
- "errors" can be: "strict", "ignore", "replace",
|
|
223
|
+
- ref: https://docs.python.org/2/howto/unicode.html#the-unicode-type
|
|
224
|
+
py3:
|
|
225
|
+
- "errors" can be: "strict", "ignore", "replace", "backslashreplace"
|
|
226
|
+
- ref: https://docs.python.org/3/howto/unicode.html#the-string-type
|
|
227
|
+
"""
|
|
228
|
+
if isinstance(value, bytes):
|
|
229
|
+
return value.decode("utf-8", errors)
|
|
230
|
+
return value
|
|
231
|
+
|
|
232
|
+
def decodeBytesToUnicodeConditional(value, errors="ignore", condition=True):
|
|
233
|
+
"""
|
|
234
|
+
if *condition*, then call decodeBytesToUnicode(*value*, *errors*),
|
|
235
|
+
else return *value*
|
|
236
|
+
|
|
237
|
+
This may be useful when we want to conditionally apply decodeBytesToUnicode,
|
|
238
|
+
maintaining brevity.
|
|
239
|
+
|
|
240
|
+
Parameters
|
|
241
|
+
----------
|
|
242
|
+
value : any
|
|
243
|
+
passed to decodeBytesToUnicode
|
|
244
|
+
errors: str
|
|
245
|
+
passed to decodeBytesToUnicode
|
|
246
|
+
condition: boolean of object with attribute __bool__()
|
|
247
|
+
if True, then we run decodeBytesToUnicode. Usually PY2/PY3
|
|
248
|
+
"""
|
|
249
|
+
if condition:
|
|
250
|
+
return decodeBytesToUnicode(value, errors)
|
|
251
|
+
return value
|
|
252
|
+
|
|
253
|
+
def encodeUnicodeToBytes(value, errors="strict"):
|
|
254
|
+
"""
|
|
255
|
+
Accepts an input "value" of generic type.
|
|
256
|
+
|
|
257
|
+
If "value" is a string of type sequence of unicode (i.e. in py2 `unicode` or
|
|
258
|
+
`future.types.newstr.newstr`, in py3 `str`), then it is converted to
|
|
259
|
+
a sequence of bytes.
|
|
260
|
+
|
|
261
|
+
This function is useful for encoding output data when using the
|
|
262
|
+
"unicode sandwich" approach, which involves converting unicode (i.e. strings
|
|
263
|
+
of type sequence of unicode codepoints) to bytes (i.e. strings of type
|
|
264
|
+
sequence of bytes, in py2 `str` or `future.types.newbytes.newbytes`,
|
|
265
|
+
in py3 `bytes`) as late as possible when passing a string to a third-party
|
|
266
|
+
function that only accepts bytes as input (pycurl's curl.setop is an
|
|
267
|
+
example).
|
|
268
|
+
py2:
|
|
269
|
+
- "errors" can be: "strict", "ignore", "replace", "xmlcharrefreplace"
|
|
270
|
+
- ref: https://docs.python.org/2/howto/unicode.html#the-unicode-type
|
|
271
|
+
py3:
|
|
272
|
+
- "errors" can be: "strict", "ignore", "replace", "backslashreplace",
|
|
273
|
+
"xmlcharrefreplace", "namereplace"
|
|
274
|
+
- ref: https://docs.python.org/3/howto/unicode.html#the-string-type
|
|
275
|
+
"""
|
|
276
|
+
if isinstance(value, str):
|
|
277
|
+
return value.encode("utf-8", errors)
|
|
278
|
+
return value
|
|
279
|
+
|
|
280
|
+
def encodeUnicodeToBytesConditional(value, errors="ignore", condition=True):
|
|
281
|
+
"""
|
|
282
|
+
if *condition*, then call encodeUnicodeToBytes(*value*, *errors*),
|
|
283
|
+
else return *value*
|
|
284
|
+
|
|
285
|
+
This may be useful when we want to conditionally apply encodeUnicodeToBytes,
|
|
286
|
+
maintaining brevity.
|
|
287
|
+
|
|
288
|
+
Parameters
|
|
289
|
+
----------
|
|
290
|
+
value : any
|
|
291
|
+
passed to encodeUnicodeToBytes
|
|
292
|
+
errors: str
|
|
293
|
+
passed to encodeUnicodeToBytes
|
|
294
|
+
condition: boolean of object with attribute __bool__()
|
|
295
|
+
if True, then we run encodeUnicodeToBytes. Usually PY2/PY3
|
|
296
|
+
"""
|
|
297
|
+
if condition:
|
|
298
|
+
return encodeUnicodeToBytes(value, errors)
|
|
299
|
+
return value
|
|
300
|
+
|
|
301
|
+
def normalize_spaces(text):
|
|
302
|
+
"""
|
|
303
|
+
Helper function to remove any number of empty spaces within given text and replace
|
|
304
|
+
then with single space.
|
|
305
|
+
:param text: string
|
|
306
|
+
:return: normalized string
|
|
307
|
+
"""
|
|
308
|
+
return re.sub(r'\s+', ' ', text).strip()
|
Utils/__init__.py
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# encoding: utf-8
|
|
3
|
+
"""
|
|
4
|
+
Collection.py
|
|
5
|
+
|
|
6
|
+
Created by Dave Evans on 2010-03-11.
|
|
7
|
+
Copyright (c) 2010 Fermilab. All rights reserved.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from WMCore.DataStructs.WMObject import WMObject
|
|
11
|
+
import WMCore.ACDC.CollectionTypes as CollectionTypes
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class Collection(dict, WMObject):
|
|
15
|
+
def __init__(self, **options):
|
|
16
|
+
dict.__init__(self)
|
|
17
|
+
WMObject.__init__(self)
|
|
18
|
+
self.setdefault("name", None)
|
|
19
|
+
self.setdefault("type", CollectionTypes.GenericCollection)
|
|
20
|
+
self.setdefault("filesets", [])
|
|
21
|
+
self.update(options)
|
|
22
|
+
|
|
23
|
+
def create(self, unique=False):
|
|
24
|
+
"""
|
|
25
|
+
_create_
|
|
26
|
+
|
|
27
|
+
Create this Collection in the back end
|
|
28
|
+
|
|
29
|
+
"""
|
|
30
|
+
pass
|
|
31
|
+
|
|
32
|
+
def populate(self):
|
|
33
|
+
"""
|
|
34
|
+
_populate_
|
|
35
|
+
|
|
36
|
+
Pull in all filesets & file entries
|
|
37
|
+
|
|
38
|
+
"""
|
|
39
|
+
pass
|
|
40
|
+
|
|
41
|
+
def drop(self):
|
|
42
|
+
"""
|
|
43
|
+
_drop_
|
|
44
|
+
|
|
45
|
+
Remove this collection.
|
|
46
|
+
"""
|
|
47
|
+
pass
|
|
48
|
+
|
|
49
|
+
def addFileset(self, fileset):
|
|
50
|
+
"""
|
|
51
|
+
_addFiles_
|
|
52
|
+
|
|
53
|
+
Add a fileset to the collection.
|
|
54
|
+
"""
|
|
55
|
+
fileset.setCollection(self)
|
|
56
|
+
self["filesets"].append(fileset)
|
|
57
|
+
return
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# encoding: utf-8
|
|
3
|
+
"""
|
|
4
|
+
CollectionTypes.py
|
|
5
|
+
|
|
6
|
+
Created by Dave Evans on 2010-03-05.
|
|
7
|
+
Copyright (c) 2010 Fermilab. All rights reserved.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
GenericCollection = "ACDC.CollectionTypes.GenericCollection"
|
|
12
|
+
DataCollection = "ACDC.CollectionTypes.DataCollection"
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
"""
|
|
3
|
+
CouchCollection.py
|
|
4
|
+
|
|
5
|
+
Created by Dave Evans on 2010-03-14.
|
|
6
|
+
Copyright (c) 2010 Fermilab. All rights reserved.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from WMCore.ACDC.Collection import Collection
|
|
10
|
+
from WMCore.ACDC.CouchFileset import CouchFileset
|
|
11
|
+
from WMCore.Database.CouchUtils import connectToCouch
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class CouchCollection(Collection):
|
|
15
|
+
"""
|
|
16
|
+
Collection that can be stored in CouchDB.
|
|
17
|
+
|
|
18
|
+
Required Args:
|
|
19
|
+
database - CouchDB database instance name
|
|
20
|
+
url - CouchDB Server URL
|
|
21
|
+
name - name of the collection
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
def __init__(self, **options):
|
|
25
|
+
Collection.__init__(self, **options)
|
|
26
|
+
self.url = options.get("url")
|
|
27
|
+
self.database = options.get("database")
|
|
28
|
+
self.name = options.get("name")
|
|
29
|
+
self.server = None
|
|
30
|
+
self.couchdb = None
|
|
31
|
+
|
|
32
|
+
@connectToCouch
|
|
33
|
+
def drop(self):
|
|
34
|
+
"""
|
|
35
|
+
_drop_
|
|
36
|
+
|
|
37
|
+
Drop this collection and all files and filesets within it.
|
|
38
|
+
"""
|
|
39
|
+
params = {"startkey": [self.name],
|
|
40
|
+
"endkey": [self.name, {}],
|
|
41
|
+
"reduce": False}
|
|
42
|
+
result = self.couchdb.loadView("ACDC", "coll_fileset_docs",
|
|
43
|
+
params)
|
|
44
|
+
|
|
45
|
+
for row in result["rows"]:
|
|
46
|
+
self.couchdb.delete_doc(row["id"])
|
|
47
|
+
return
|
|
48
|
+
|
|
49
|
+
@connectToCouch
|
|
50
|
+
def populate(self):
|
|
51
|
+
"""
|
|
52
|
+
_populate_
|
|
53
|
+
|
|
54
|
+
The load the collection and all filesets and files out of couch.
|
|
55
|
+
"""
|
|
56
|
+
params = {"startkey": [self.name],
|
|
57
|
+
"endkey": [self.name, {}],
|
|
58
|
+
"reduce": True, "group_level": 2}
|
|
59
|
+
result = self.couchdb.loadView("ACDC", "coll_fileset_docs",
|
|
60
|
+
params)
|
|
61
|
+
self["filesets"] = []
|
|
62
|
+
for row in result["rows"]:
|
|
63
|
+
fileset = CouchFileset(database=self.database, url=self.url,
|
|
64
|
+
name=row["key"][1])
|
|
65
|
+
self.addFileset(fileset)
|
|
66
|
+
fileset.populate()
|
|
67
|
+
return
|