Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:20:48

0001 #!/usr/bin/env python 
0002 
0003 # https://twiki.cern.ch/twiki/bin/viewauth/CMS/DqmRrApi
0004 
0005 from __future__ import absolute_import
0006 from sys import stderr, exit
0007 import xml.dom.minidom
0008 from .rrapi import RRApi, RRApiError
0009 
0010 def queryRR(firstRun,lastRun,groupName):
0011     rrurl = "http://runregistry.web.cern.ch/runregistry/"
0012     stderr.write("Querying run registry for range [%d, %d], group name like %s ...\n" % (firstRun, lastRun, groupName))
0013     server = RRApi(rrurl)
0014     mycolumns = ['number', 'hltKeyDescription', 'runClassName']
0015     run_data = server.data(workspace = 'GLOBAL', table = 'runsummary', template = 'xml', columns = mycolumns, filter = {'datasetExists': '= true', 'number':'>= %d and <= %d'%(firstRun,lastRun), 'runClassName':"like '%%%s%%'"%groupName})
0016     ret = {}
0017     xml_data = xml.dom.minidom.parseString(run_data)
0018     xml_runs = xml_data.documentElement.getElementsByTagName("RunSummaryRowGlobal")
0019     for xml_run in xml_runs:
0020         ret[xml_run.getElementsByTagName("number")[0].firstChild.nodeValue] = xml_run.getElementsByTagName("hltKeyDescription")[0].firstChild.nodeValue
0021     return ret