def main(): #a list of workflows usage = "python %prog [OPTIONS] WORKFLOWS" parser = OptionParser(usage=usage) parser.add_option('-f', '--file', help='Text file with a list of workflows', dest='file') (options, args) = parser.parse_args() if options.file: workflows = [l.strip() for l in open(options.file) if l.strip()] else: workflows = args 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())
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())
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())
def loadJobSummary(rList): """ Loads job summary from wmstats """ #JSON job summary from WMStats view wMStats = WMStatsClient("https://cmsweb.cern.ch/couchdb/wmstats") jlist = {} print "Getting job information" for wf in rList: try: jdata = wMStats.getRequestByNames([wf], jobInfoFlag = True) print wf requestCol = RequestInfoCollection(jdata) for wf2, info in requestCol.getData().items(): jlist[wf2] = {} for t,n in info.getJobSummary().getJSONStatus().items(): jlist[wf2][t]=n except KeyError as e: print "ERROR, Cannot get job stats for", wf print e except Exception as e: print "ERROR, Cannot get job stats for", wf print e return jlist