Exemplo n.º 1
0
def dbsQuery(dataset, minRun = 1, maxRun = -1):
    """
    Query DBS to ge the list of runs and the # of events for each run
   
    dbs_cmd = 'dbs search --noheader --query="find run,sum(file.numevents) where dataset=' + dataset
    if minRun > 1:
        dbs_cmd += ' and run > ' + str(minRun)
    if maxRun != -1:
        dbs_cmd += ' and run < ' + str(maxRun)
    """
       
    """dbs_cmd += '"'
    #print dbs_cmd
    dbs_out = commands.getstatusoutput(dbs_cmd)
    return dbs_out"""

    dlist = ""
    runs = api.listRuns(dataset=dataset)[0].get("run_num")
    for run in runs:
       
        dlist += str(run)
        events = api.listFileSummaries(dataset=dataset, run_num = run)[0]
        #dlist.append(run)
        dlist += " "  + str(events.get("num_event"))
        dlist += "\n"   
    return dlist
Exemplo n.º 2
0
def dbsQueryMinRun(dataset):
    """
    Query DBS for the minimum run number in the dataset
    dbs_cmd = 'dbs search --noheader --query="find min(run) where dataset=' + dataset
    dbs_cmd += '"'
    
    #print dbs_cmd
    dbs_out = commands.getstatusoutput(dbs_cmd)
    return dbs_out
    """
    runs = api.listRuns(dataset=dataset)[0]
    return min(runs.get("run_num"))