forked from CMSCompOps/WmAgentScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix_merge_acdc.py
More file actions
executable file
·27 lines (18 loc) · 832 Bytes
/
fix_merge_acdc.py
File metadata and controls
executable file
·27 lines (18 loc) · 832 Bytes
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
#!/usr/bin/env python
import sys
import pickle
from WMCore.Database.CMSCouch import CouchDBRequests
requestName = sys.argv[1]
requestor = CouchDBRequests(url = "https://cmsweb.cern.ch")
wlpkl = requestor.makeRequest(uri = "/couchdb/reqmgr_workload_cache/%s/spec" % requestName, decode = False)
wldoc = requestor.makeRequest(uri = "/couchdb/reqmgr_workload_cache/%s" % requestName)
wl = pickle.loads(wlpkl)
if len(wl.tasks.tasklist) == 1:
print "Request only has one top level task, nothing to fix."
sys.exit(1)
for taskName in wl.tasks.tasklist:
if taskName.find("Cleanup") != -1:
break
wl.tasks.tasklist.remove(taskName)
newwlpkl = pickle.dumps(wl)
requestor.makeRequest(uri = "/couchdb/reqmgr_workload_cache/%s/spec?rev=%s" % (requestName, wldoc["_rev"]), type="PUT", data = newwlpkl, encode = False)