Skip to content

A simple Python client to access the CMS DQM Run Registry via resthub

Notifications You must be signed in to change notification settings

ptrstn/python-runregistryclient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Code style: black

python-runregistryclient

Implements a simple Python client that accesses the RunRegistry through the resthub interface.

Install instructions

pip install git+https://github.com/ptrstn/python-runregistryclient.git

Example usage

from runregistry.client import RunRegistryClient

client = RunRegistryClient()
query = (
    "select r.runnumber from runreg_global.runs r "
    "where r.run_class_name = 'Collisions15'"
    "and r.runnumber > 247070 and r.runnumber < 247081"
)
client.execute_query(query)

Output:

{'data': [[247073], [247076], [247077], [247078], [247079]]}

Command line interface

After installing the package, the runreg cli script is available.

Help

runreg --help
usage: runreg [-h] [-i] [-q query] [-f {text,xml,json,json2,csv}]

Run Registry command line client.

optional arguments:
  -h, --help               show this help message and exit
  -i, --info               General information about the service
  -q query                 SQL query used to access the Run Registry.
  -f {xml,json,json2,csv}  Specify output format

Example

runreg -q "select max(r.runnumber) as max_run from runreg_tracker.runs r where r.run_class_name = 'Collisions15'"

Output:

MAX_RUN
263757

Retrieve lumi sections JSON

To retrieve lumi sections in a JSON format check out https://github.com/ptrstn/lumis

Run tests

Make sure that you are within the CERN GPN.

python -m unittest
python -m doctest -v runregistry\client.py
python -m doctest -v runregistry\tracker\client.py
python -m doctest -v runregistry\tracker\lumis.py
python -m doctest -v runregistry\tracker\utilities.py

References

About

A simple Python client to access the CMS DQM Run Registry via resthub

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages