Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

No project description provided

Project description

Build Status codecov Code style: black

CERN CMS Run Registry client

A Python client for the new RunRegistry. A Python client for the old RunRegistry can be found here.

Installation

pip install runregistryclient

Usage

Example

If you want a single run, do this:

import runreg

runreg.get(run_number=327600)

If you prefer a non-nested JSON output, use the flat=True parameter.

import runreg

runreg.get(run_number=327600, flat=True)

runreg assumes the tracker workspace by default. If you want to change it, you can do so by specifying the workspace attribute:

import runreg

runreg.get(run_number=327600, workspace="global")

Multiple filters at once

If you want to use several filters at once, for example, to filter according to a sequence number range with certain criteria, you can do it this way:

import runreg

runreg.get(run_number=[(327596, ">="), (327744, "lte")], name=("%Cosmics%", "like"))

Or if you prefer Django like lookup fields:

import runreg

runreg.get(run_number__gte=327596, run_number__lte=327744, name__like="%Cosmics%")

Operators

Following operators are supported:

  • = or eq (assumed per default)
  • >= or gte
  • > or gt
  • <= or lte
  • < or lt
  • like

The operators should be specified as the second element of a (value, operator) tuple such as (321123, "<=").

Attributes

All available attributes can be found in the docs folder under attributes.md.

Development

Python version 3.5 or higher is required.

If you want to improve this software, you should follow these steps:

git clone https://github.com/ptrstn/runregistryclient
cd runregistryclient
python -m venv venv
. venv/bin/activate
pip install -e .
pip install -r testing-requirements.txt

Running Tests

pytest --cov .

FAQ

How do you filter by subcomponent status?

If you want to filter for subcomponent states such as Pixel or SiStrip, you must use the attribute names specified in the RunRegistry API. Unfortunately, they contain "-" and "." characters, so you need to use a little trick.

For example, to filter for the Track Status in the workspace Tracker then you need to do:

import runreg

runreg.get(**{"tracker-track.status": "GOOD"})

You can still combine this with other attributes and options:

import runreg

runreg.get(flat=True, run_number=[(327596, ">="), (327744, "lte")], **{"pix.status": "EXCLUDED", "strip.status":"GOOD"})

Whats the difference between tracker-track and track?

track is used for the global workspace, while tracker-track uses the tracker workspace. The same is true for tracker-pix / pix and tracker-strip / strip.

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for runregistryclient, version 0.2.1
Filename, size File type Python version Upload date Hashes
Filename, size runregistryclient-0.2.1-py3-none-any.whl (17.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size runregistryclient-0.2.1.tar.gz (4.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page