forked from CMSCompOps/WmAgentScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WorkflowJobInfo.py
30 lines (23 loc) · 888 Bytes
/
WorkflowJobInfo.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
from WMCoreService.WMStatsClient import WMStatsClient
from WMCoreService.DataStruct.RequestInfoCollection import RequestInfoCollection, RequestInfo
import sys
url = "https://cmsweb.cern.ch/couchdb/wmstats"
def main():
#a list of workflows
workflows = sys.argv[1:]
wMStats = WMStatsClient(url)
print "start to getting job information from %s" % url
#retrieve job information
workflowsWithData = wMStats.getRequestByNames(workflows, jobInfoFlag = True)
print '-'*120
#print workflowsWithData
requestCol = RequestInfoCollection(workflowsWithData)
#print summary for each workflow
for wf, info in requestCol.getData().items():
print '-'*120
print wf
#a table
print '\n'.join( "%10s %10s"%(t,n)
for t,n in info.getJobSummary().getJSONStatus().items())
if __name__ == "__main__":
main()