forked from CMSCompOps/WmAgentScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
closeOutWorkflowsManual.py
39 lines (32 loc) · 1.11 KB
/
closeOutWorkflowsManual.py
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
#!/usr/bin/env python
"""
Close out a given list of workflows. It will search for any Resubmission requests
for which the given request is a parent and announce them too.
input arg: Text file with list of workflows.
"""
import sys
import optparse
import reqMgrClient
url='cmsweb.cern.ch'
def main():
parser = optparse.OptionParser()
parser.add_option('-f', '--file', help='Text file', dest='file')
(options, args) = parser.parse_args()
if options.file:
workflows = [wf.strip() for wf in open(options.file) if wf.strip()]
elif len(args) >= 1:
workflows = args
else:
parser.error("Provide the workflow names or a text file")
sys.exit(0)
for workflow in workflows:
print "Closing-out workflow: " + workflow +". Look for resubmissions and close them too"
result = reqMgrClient.closeOutWorkflowCascade(url, workflow)
if result == None or result == 'None':
print "Closed out"
else:
print "ERROR NOT CLOSED OUT"
print result
sys.exit(0);
if __name__ == "__main__":
main()