HOWTO update a condition on the RCDB

From GlueXWiki
Revision as of 11:38, 3 May 2021 by Sdobbs (Talk | contribs) (Created page with "Sometimes the information in the RCDB needs to be modified. The first warning is to BE VERY CAREFUL when you are doing this, since the RCDB does not keep any history of modif...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Sometimes the information in the RCDB needs to be modified. The first warning is to BE VERY CAREFUL when you are doing this, since the RCDB does not keep any history of modifications, unlike the CCDB.

The master RCDB is only modifiable from the counting house. Let's say that you want to update the data stored in a condition for one specific run (here is the list of conditions). Note that more details and example code can be found on the RCDB GitHub pages.

Below is an example python script that can make this change, with dummy values put in

import rcdb
from rcdb.model import ConditionType, Condition, Run

# set up the connection to the master RCDB
db = rcdb.RCDBProvider("mysql://rcdb:<password>@gluondb1/rcdb")  # replaced <password> with the master RCDB password

# update condition "evio_files_count" to NEW_VALUE for a given run number
run = SOME_RUN_NUMBER
db.add_condition(run, "evio_files_count", NEW_VALUE, True)