XavierAtCERN / dqm-playground-cli

Command line interface for accessing the CMS DQM Playground

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DQM Playground - Command Line Interface

Build Status Code style: black

Project overview

The goal of this package is to provide a user interface between the DQM Playground DB aiming at gathering information from various sources and the data science framework chosen to create models for anomaly detection.

An overview of the architecture of the project highlighting the role of the CLI can be found below.

Architecture of the project

Setting up the CLI

To build the cli:

git clone https://github.com/XavierAtCERN/dqm-playground-cli

cd dqm-playground-cli
pip3 install --upgrade -r requirements.txt
pip3 install --editable .

A naive skeleton of the cli (built using Click) can be found below.

Runs

dqm_playground_cli runs --help
Usage: dqm_playground_cli runs [OPTIONS]

  This subcommand provides a list of runs and their variables

Options:
  --run_list BOOLEAN       Provides list of runs.
  --run_number INTEGER     Run number for variable exploration.
  --variable_list BOOLEAN  Provides list of variables.
  --help                   Show this message and exit.

Accessing all available runs:

dqm_playground_cli runs --run_list=True

Accessing all variables from a given run (315257):

dqm_playground_cli runs --variable_list=True --run_number=315257

Lumisections

dqm_playground_cli lumisections --help
Usage: dqm_playground_cli lumisections [OPTIONS]

  This subcommand provides a list of lumisections associated to a run and
  their variables

Options:
  --run_number INTEGER        Run number for lumisection exploration
  --lumisection_list BOOLEAN  Provides list of lumisection for a given run
  --variable_list BOOLEAN     Provides list of variables for a given
                              lumisection
  --lumi_number INTEGER       Lumisection number for variable exploration
  --help                      Show this message and exit.

Accessing all lumisections from a given run:

dqm_playground_cli lumisections --run_number=0 --lumisection_list True # run not in the DB
dqm_playground_cli lumisections --run_number=297176 --lumisection_list True # run in the DB

Tasks

dqm_playground_cli tasks --help
Usage: dqm_playground_cli tasks [OPTIONS]

  This subcommand provides a list of the avaiable tasks

Options:
  --run_number INTEGER          Run number for lumisection exploration
  --dummy_task BOOLEAN          Create dummy task by sampling 10 lumisections
                                from run_number
  --variables_for_task BOOLEAN  Create file with variables needed for (dummy)
                                task
  --help                        Show this message and exit.

Creating a dummy task (runs+lumisections)

dqm_playground_cli tasks --run_number=297176 --dummy_task True

Extracting variables for a specific task

dqm_playground_cli tasks --run_number=297176 --variables_for_task True

Going further

To go further with Click, a useful introduction can be found here.

About

Command line interface for accessing the CMS DQM Playground


Languages

Language:Python 100.0%