forked from CMSCompOps/WmAgentScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathannounceWorkflows.py
executable file
·34 lines (31 loc) · 954 Bytes
/
announceWorkflows.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
#!/usr/bin/env python
"""
Announc 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 urllib2,urllib, httplib, sys, re, os
try:
import json
except:
import simplejson as json
import reqMgrClient
def main():
"""
Read the text file, for each workflow try:
Announce it.
"""
args=sys.argv[1:]
if not len(args)==1:
print "usage:announceWorkflows file.txt"
sys.exit(0)
url='cmsweb.cern.ch'
filename=args[0]
workflows = [wf.strip() for wf in open(filename).readlines() if wf.strip()]
for workflow in workflows:
print "Announcing workflow: " + workflow +". Look for resubmissions and announce them too"
reqMgrClient.announceWorkflowCascade(url, workflow)
print "Announced"
sys.exit(0);
if __name__ == "__main__":
main()