CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
queryRR.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 # https://twiki.cern.ch/twiki/bin/viewauth/CMS/DqmRrApi
4 
5 from sys import stderr, exit
6 import xml.dom.minidom
7 from rrapi import RRApi, RRApiError
8 
9 def queryRR(firstRun,lastRun,groupName):
10  rrurl = "http://runregistry.web.cern.ch/runregistry/"
11  stderr.write("Querying run registry for range [%d, %d], group name like %s ...\n" % (firstRun, lastRun, groupName))
12  server = RRApi(rrurl)
13  mycolumns = ['number', 'hltKeyDescription', 'runClassName']
14  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})
15  ret = {}
16  xml_data = xml.dom.minidom.parseString(run_data)
17  xml_runs = xml_data.documentElement.getElementsByTagName("RunSummaryRowGlobal")
18  for xml_run in xml_runs:
19  ret[xml_run.getElementsByTagName("number")[0].firstChild.nodeValue] = xml_run.getElementsByTagName("hltKeyDescription")[0].firstChild.nodeValue
20  return ret
def queryRR
Definition: queryRR.py:9