RCDB
General Information
- HallC RCDB Home: https://hallcweb.jlab.org/rcdb
- https://www.overleaf.com/read/sbcjbvywpwnb
- PREX/CREX RCDB Wiki page (old but some information might be helpful): https://prex.jlab.org/wiki/index.php/PVDB
HallC Run database stores run related information using mysql database and the RCDB. It utilizes existing RCDB framework, that was initially developed and used for Hall D, for data management, parser, logging and etc. While we keep the same database schema from the rcdb, we cam also add experiment specific conditions. For the full list of conditions, see https://hallcweb.jlab.org/rcdb/conditions/.
databases and server information
The master database server is running on cdaqdb1. There are currently 3 databases:
- c-rcdb: HallC database for RCDB
- a-rcdb: used for PREX/CREX experiment in Hall A
- rcdb: used for test
They are also replicated from cdaqdb1 to hallcdb. The RCDB process runs on the read-only copy from hallcdb.
The master database should be only accessed when adding new entries, at the start/end of run, for example. This is done automatically by running python scripts. The connection string is set to the master database by default on cdaq machines in order to fill run conditions to the DB.
Git repositories
- RCDB: https://github.com/JeffersonLab/rcdb
- HallC scripts: https://github.com/JeffersonLab/hallcdb
- PREX/CREX (some example scripts might be still useful): https://github.com/JeffersonLab/pvdb
Instruction for general users and analyzers
Connection:
One can access the DB copy from any jlab network computer as rcdb user (no password required). The connection string can be set in a script, for example:
con_str = "mysql://rcdb@hallcdb.jlab.org/c-rcdb" db = rcdb.RCDBProvider(con_str)
Or, set this environment variable
setenv RCDB_CONNECTION mysql://rcdb@hallcdb.jlab.org/c-rcdb (csh) export RCDB_CONNECTION=mysql://rcdb@hallcdb.jlab.org/c-rcdb (bash)
Use search query from RCDB Home
From RCDB Home (https://hallcweb.jlab.org/rcdb/):
on search query, type database query.
For example: run_type == "Elastic"
How to add/modify some of the DB entries
Using RCDB EDIT GUI
On cdaq machines as cdaq user:
> rcdb_edit
This will bring up a GUI.
- Type Run number and click "Connect" -- this will load the existing values.
- Select Run type if you want to change, add/modify comments, set flag for the run as needed.
- Click "Save and Exit" to put the new conditions into the database.
Simple update script example for many runs/conditions
One can update a list of runs for various conditions using an example script. Log in to cdaq machines as cdaq user:
> ssh cdaq@cdaql3 (for example)
Copy this script to your working directory
> cp rcdb/hallcdb/scripts/examples/update_conditions.py <your directory>
The script requires an input text file with the following format:
run# <condition name> <value to write/replace>
For example:
3000 run_type Junk 3001 run_type Production 3001 user_comment write your comment here
In the script, you can set TESTMODE to True to test the script. If set, it won't actually update the DB but will print out the input contents.
To update the DB, set TESTMODE to False and type
> python3 update_conditions.py <input file name>
Make a run list from DB
- Old example used for PREX/CREX: https://github.com/JeffersonLab/pvdb/blob/master/prex/examples/make_run_list.py