Ejemplo n.º 1
0
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())
Ejemplo n.º 2
0
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
Ejemplo n.º 3
0
    'announced'
]

#names of T1's
t2zone = {
    'T1_TW_ASGC': 'ASGC',
    'T1_IT_CNAF': 'CNAF',
    'T1_DE_KIT': 'KIT',
    'T1_FR_CCIN2P3': 'IN2P3',
    'T1_ES_PIC': 'PIC',
    'T1_UK_RAL': 'RAL',
    'T1_US_FNAL': 'FNAL'
}

DATE_FORMAT = '%Y-%m-%d %H:%M:%S.%f'
wMStats = WMStatsClient("https://cmsweb.cern.ch/couchdb/wmstats")


def getoverview():
    """
    Reads cached overview that contains a list of requests
    in the system.
    """
    #
    global cachedoverview
    if not os.path.exists(cachedoverview):
        print "Cannot get overview from %s" % cachedoverview
        sys.exit(1)
    d = open(cachedoverview).read()
    s = eval(d)
    return s
Ejemplo n.º 4
0
from WMCoreService.WMStatsClient import WMStatsClient
from WMCoreService.DataStruct.RequestInfoCollection import RequestInfoCollection

if __name__ == "__main__":
    url = "https://cmsweb-testbed.cern.ch/couchdb/wmstats"
    testbedWMStats = WMStatsClient(url)
    print "start to getting job information from %s" % url
    print "will take a while\n"
    requests = testbedWMStats.getRequestByStatus(["running-closed"],
                                                 jobInfoFlag=True)
    requestCollection = RequestInfoCollection(requests)
    result = requestCollection.getJSONData()
    print result
    print "\ntotal %s requests retrieved" % len(result)
    requestsDict = requestCollection.getData()
    for requestName, requestInfo in requestsDict.items():
        print requestName + " :"
        print "\ttotalLuims: %s" % requestInfo.getTotalInputLumis()
        print "\ttotalEvents: %s" % requestInfo.getTotalInputEvents()
        print "\ttotal top level jobs: %s" % requestInfo.getTotalTopLevelJobs()
        print "\ttotal top level jobs in wmbs: %s" % requestInfo.getTotalTopLevelJobsInWMBS(
        )
        print "\tProgress by output dataset:"
        summaryDict = requestInfo.getProgressSummaryByOutputDataset()
        for oDataset, summary in summaryDict.items():
            print "\t  %s" % oDataset
            print "\t   %s" % summary.getReport()
        print "\n"
    print "done"