The run number is an integer, that uniquely identify a data taking run.

Introduction

The Run Number Service has been proposed and discussed during May 2006 TDAQ week:

Design

Implementation

The Run Number service is implemented by the package rn. Below there are details on relational table used by rn service implementation, C++ API and user interfaces.

The relational table info

The run number and associated information is stored in the RunNumber relational table, where the run number is a column. In addition to the RunNumber column, the table stores the following data:

C++ API

The rn is implemented on top of CORAL. To get new run number one has to create an object of the tdaq::RunNumber class. It's constructor talks with the database, creates new run  number record and fills know information. To get run number one has to use method run_number() invoked on the created object. When the object is destructed, it talks with database again and updates second part of the run number record (StopAt, ConfigVersions, Comments).

The following parameters to be provided to the constructor RunNumber(const std::string& connect, const std::string& partition, unsigned long existing_rn = 0):

If connect parameter is empty, it is read from TDAQ_RUN_NUMBER_CONNECT environment variable. If partition parameter is empty, it is read from TDAQ_PARTITION environment variable. If a parameter is empty and the corresponding variable is not defined or empty, it is considered an error.

All the errors are reported to ERS.

Example:

try {
  tdaq::RunNumber test("test:onlcool:oracle://devdb10/tdaq_dev_backup", "my-partition");
  std::cout << "New run number is " << test.get_number() << std::endl;
  std::cout << "Sleep 2 seconds ..." << std::endl; sleep(2);  # just to make non-zero run duration
  test.set_comments("It is just a test run.");
catch (ers::Issue &ex) {
  ers::error(ex);
}
Text-based user interface

The information about runs can be obtained using rn_ls utility.

usage: rn_ls
   -c | --connect-string connect_string
   -w | --working-schema schema_name
   [-l | --list-databases]
   [-d | --database name]
   [-s | --started-since timestamp]
   [-t | --started-till timestamp]
   [-f | --minimal-duration duration]
   [-i | --maximal-duration duration]
   [-n | --minimal-run-number number]
   [-m | --maximal-run-number number]
   [-h | --help]
Options/Arguments:
   -c connect_string    database connection string
   -w schema_name       name of working schema
   -l                   list database names holding run numbers
   -d name              name of the database holding run numbers
   -s timestamp         show run numbers started since given moment
   -t timestamp         show run numbers started before given moment
   -f duration          show runs last longer given duration
   -i duration          show runs last shorter given duration
   -n number            show run numbers greater or equal to given one
   -m number            show run numbers less or equal to given one
   -h                   print this message
Description:
   The utility prints out information about run numbers.
   The timestamps to be provided in ISO 8601 format: "YYYY-MM-DD HH:MM:SS".
   The durations  to be provided in  format: "HH:MM:SS".
Web GUI

The test GUI is available on: http://cern.ch/isolov/cgi-bin/rn.pl

This is a web-based GUI using rn_ls utility.