Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions python/daq/update_epics.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def update_beam_conditions(run, log=log):
# iterate over output
n = 0
for line in p.stdout:
#print(line.strip())
n += 1
if n == 1: # skip header
continue
Expand All @@ -98,7 +99,8 @@ def update_beam_conditions(run, log=log):
continue
key = tokens[0]
value = tokens[2] # average value
if key == "IBCAD00CRCUR6":
if key == b'IBCAD00CRCUR6':
log.debug(Lf("Saving beam_current = '{}'", float(value)))
conditions["beam_current"] = float(value)

except Exception as e:
Expand All @@ -116,7 +118,7 @@ def update_beam_conditions(run, log=log):
# iterate over output
n = 0
for line in p.stdout:
print(line.strip())
#print(line.strip())
n += 1
if n == 1: # skip header
continue
Expand All @@ -125,7 +127,8 @@ def update_beam_conditions(run, log=log):
continue
key = tokens[0]
value = tokens[2] # average value
if key == "IBCAD00CRCUR6":
if key == b"IBCAD00CRCUR6":
log.debug(Lf("Saving beam_on_current = '{}'", float(value)))
conditions["beam_on_current"] = float(value)
log.debug("Done with beam_current")
except Exception as e:
Expand All @@ -147,7 +150,7 @@ def update_beam_conditions(run, log=log):
# wait process end and iterate over output
n = 0
for line in p.stdout:
print(line.strip())
#print(line.strip())
n += 1
if n == 1: # skip header
continue
Expand All @@ -164,6 +167,7 @@ def update_beam_conditions(run, log=log):
# so let's ignore the time periods and do a simple average
#avg_beam_energy /= float(n)
conditions["beam_energy"] = float("%7.1f"%(avg_beam_energy / float(nentries)))
log.debug(Lf("Saving beam_energy = '{}'", conditions["beam_energy"]))

"""
cmds = ["myStats", "-b", begin_time_str, "-e", end_time_str, "-c", "IBCAD00CRCUR6", "-r", "30:5000", "-l", "HALLD:p"]
Expand Down Expand Up @@ -209,7 +213,8 @@ def update_beam_conditions(run, log=log):
continue
key = tokens[0]
value = tokens[2] # average value
if key == "RESET:i:GasPanelBarPress1":
if key == b"RESET:i:GasPanelBarPress1":
log.debug(Lf("Saving cdc_gas_pressure = '{}'", float(value)))
conditions["cdc_gas_pressure"] = float(value)
log.debug("Done with cdc_gas_pressure")
except Exception as e:
Expand Down Expand Up @@ -473,7 +478,7 @@ def update_rcdb_conds(db, run, reason):
run_number = int(sys.argv[2])
update_reason = sys.argv[3]

db = rcdb.RCDBProvider("mysql://rcdb:%s@gluondb1/rcdb"%password)
db = rcdb.RCDBProvider("mysql://rcdb:%s@gluondb1/rcdb2"%password)
if not db.get_run(run_number):
raise ValueError("Run number '{}' is not found in DB", run_number)
update_rcdb_conds(db, run_number, update_reason)
Expand Down