Skip to content

Commit cc8f8dc

Browse files
authored
Merge pull request #242 from JeffersonLab/nsj_getrcdb
add script to get all RCDB info for a run - jolly useful when the GUI is offline
2 parents 004aa98 + a7888dd commit cc8f8dc

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

RCDB_scripts/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# RCDB_scripts
2+
3+
getrcdb.py : Show all RCDB info for a given run or run range

RCDB_scripts/getrcdb.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# script to show all RCDB conditions for specified run(s)
2+
3+
import sys
4+
import rcdb
5+
6+
if len(sys.argv) < 2 :
7+
print("Usage: python getrcdb.py <first_run_number> [<last_run_number>]")
8+
print("eg python getrcdb.py 81234")
9+
exit()
10+
11+
run1 = sys.argv[1]
12+
13+
if len(sys.argv) > 2:
14+
run2 = sys.argv[2]
15+
else:
16+
run2 = run1
17+
18+
19+
db = rcdb.RCDBProvider("mysql://rcdb@hallddb/rcdb2")
20+
String1 = ['AMO', 'PARA', 'PERP', '45DEG', '135DEG']
21+
22+
runs = db.get_runs(run1,run2)
23+
24+
for R in runs:
25+
26+
conditions_by_name = R.get_conditions_by_name()
27+
conditions = conditions_by_name.keys()
28+
29+
print( f"{'run_number':22s}",R.number)
30+
print( f"{'start_time':22s}",R.start_time)
31+
print( f"{'end_time':22s}",R.end_time)
32+
33+
for cond in conditions:
34+
cond_object = R.get_condition(cond)
35+
print( f"{cond:22s}" , cond_object.value)
36+
37+
print("#---------------------")
38+
print()
39+

0 commit comments

Comments
 (0)