Ejemplo n.º 1
0
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())
Ejemplo n.º 2
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.º 3
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.º 4
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.º 5
0

if __name__ == "__main__":
    parser = OptionParser()
    parser.add_option("-s", "--server", dest="server",
                    help="CouchDB server to write results to", )
    parser.add_option("-d", "--database", dest="database", default='latency_analytics',
                    help="CouchDB database for results")

    (options, args) = parser.parse_args()

    analyticsServer = CouchServer(options.server)
    couchdb = analyticsServer.connectDatabase(options.database)

    url = "https://cmsweb.cern.ch/couchdb/wmstats"
    WMStats = WMStatsClient(url)
    print "Getting job information from %s. Please wait." % url
    requests = WMStats.getRequestByStatus(WMStatsClient.ACTIVE_STATUS, jobInfoFlag = True)

    requestCollection = RequestInfoCollection(requests)
    result = requestCollection.getJSONData()
    requestsDict = requestCollection.getData()
    print "Total %s requests retrieved\n" % len(result)

    report = {}
    for wf in result.keys():
        # Store a copy of the CouchDB document so we can compare later before updating
        if couchdb.documentExists(wf):
            oldCouchDoc = couchdb.document(wf)
            wfExists = True
        else:
Ejemplo n.º 6
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
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"
Ejemplo n.º 8
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"