Implements a simple Python client that accesses the RunRegistry through the resthub interface.
pip install git+https://github.com/ptrstn/python-runregistryclient.git
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]]}
After installing the package, the runreg cli script is available.
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
runreg -q "select max(r.runnumber) as max_run from runreg_tracker.runs r where r.run_class_name = 'Collisions15'"
Output:
MAX_RUN
263757
To retrieve lumi sections in a JSON format check out https://github.com/ptrstn/lumis
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