Skip to main content

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

Prerequisites

Since mai 2019 the run registry requires authenticaion with a CERN user account. Therefore you need to setup your CERN Grid User Certificate as instructed in the cernrequests package:

See: https://github.com/ptrstn/cernrequests#prerequisites

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.

Does this work with Python 2.7?

No.

References

Metadata

Release files for runregistryclient 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for runregistryclient 0.3.0
File Size Uploaded
runregistryclient-0.3.0.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for runregistryclient 0.3.0
File Interpreter ABI Platform
runregistryclient-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 23.1 kB

Release files / runregistryclient-0.3.0.tar.gz

Download URL runregistryclient-0.3.0.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c70cfc0835e18fca5e218402847d3609774c7c0cd6369ce0ac2e7081f168962e
BLAKE2b-256 checksum
How to use checksums
54bbb5e8096c2893b126d292df343a7d849310226b628eed3b44e24a1bc776b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

Release files / runregistryclient-0.3.0-py3-none-any.whl

Download URL runregistryclient-0.3.0-py3-none-any.whl
Size 18.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
346a950a11b7dcbeb7acec0f0e58b768333afe73b80621d61a68bb2262a59d56
BLAKE2b-256 checksum
How to use checksums
d5bcf8b0da78cf14ab81218ddb2e693ab3216c4c517e38446e350bf17134c714
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page