forked from CMSCompOps/WmAgentScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakeAllACDCs.py
More file actions
79 lines (66 loc) · 2.39 KB
/
makeAllACDCs.py
File metadata and controls
79 lines (66 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env python
"""
Create one acdc for every task that has an ACDC document
Use: wfname
It will copy all the original workflow parameters unless specified
"""
import sys
from optparse import OptionParser
import reqMgrClient as rqMgr
from makeACDC import makeACDC
class Config:
def __init__(self, info):
self.requestArgs = info
self.requestNames = []
self.cert = None
self.key = None
self.assignRequests = False
self.changeSplitting = False
self.assignRequest = False
def getAcdcTasks(url, workflow):
#https://cmsweb.cern.ch/couchdb/acdcserver/_design/ACDC/_view/byCollectionName?key=%22fabozzi_Run2015C_25ns-ZeroBias3-05Oct2015_7414_151015_182109_1001%22&include_docs=true&reduce=false
# ACDC documents
acdcDocs = rqMgr.requestManagerGet(url,'/couchdb/acdcserver/_design/ACDC/_view/byCollectionName?key="%s"&include_docs=true&reduce=false'%workflow)
# get the tasks
tasks = set()
if 'rows' in acdcDocs:
for doc in acdcDocs['rows'] :
if 'doc' in doc and 'fileset_name' in doc['doc']:
task = doc['doc']['fileset_name']
task = '/'.join(task.split('/')[2:])
tasks.add(task)
return tasks
def makeAllACDCs(url, workflow):
tasks = getAcdcTasks(url, workflow)
acdcs = []
for task in tasks:
print task
acdc = makeACDC(url, workflow, task)
acdcs.append(acdc)
return acdcs
def main():
url = 'cmsweb.cern.ch'
testbed_url = 'https://cmsweb-testbed.cern.ch'
#url = 'https://alan-cloud1.cern.ch'
#Create option parser
usage = "usage: %prog [options] [WORKFLOW]"
parser = OptionParser(usage=usage)
parser.add_option("-f","--file", dest="file", default=None,
help="Text file of a list of workflows")
parser.add_option("-m","--memory", dest="memory", default=None,
help="Memory to override the original request memory")
(options, args) = parser.parse_args()
wfs = None
if options.file:
wfs = [l.strip() for l in open(options.file) if l.strip()]
elif args:
wfs = args
else:
parser.error("Provide the Workflow Name")
sys.exit(1)
for wf in wfs:
acdcs = makeAllACDCs(url, wf)
print "created acdcs"
print '\n'.join(acdcs)
if __name__ == '__main__':
main()