fix: spreadsheetupdate config refrence
CI / lint (push) Skipped
CI / test (3.12) (push) Skipped
CI / test (3.13) (push) Skipped
CI / test-with-beamline-plugins (pxi_bec) (push) Skipped
CI / test-with-beamline-plugins (pxii_bec) (push) Skipped
CI / test-with-beamline-plugins (pxiii_bec) (push) Skipped
CI / lint (push) Skipped
CI / test (3.12) (push) Skipped
CI / test (3.13) (push) Skipped
CI / test-with-beamline-plugins (pxi_bec) (push) Skipped
CI / test-with-beamline-plugins (pxii_bec) (push) Skipped
CI / test-with-beamline-plugins (pxiii_bec) (push) Skipped
This commit is contained in:
@@ -30,7 +30,7 @@ def set_spreadsheet_in_redis(spreadsheet):
|
||||
"[REDIS][DEBUG] Data to write:", json.dumps(spreadsheet, indent=4)
|
||||
) # Pretty-print the data
|
||||
print("[REDIS][INFO] Writing spreadsheet to Redis...")
|
||||
config.__client.set(f"{config._bl}:spreadsheet", json.dumps(spreadsheet))
|
||||
config.redis.set(f"{config._bl}:spreadsheet", json.dumps(spreadsheet))
|
||||
|
||||
|
||||
def on_message(ws, message):
|
||||
@@ -93,19 +93,19 @@ def on_message(ws, message):
|
||||
# Write normal pucks to sample_spreadsheet
|
||||
normal_key = f"{config._bl}:sample_spreadsheet"
|
||||
normal_list = SampleShortInfoList(s=normal_short_infos)
|
||||
config._client.set(normal_key, normal_list.model_dump_json())
|
||||
config.redis.set(normal_key, normal_list.model_dump_json())
|
||||
print("[REDIS][INFO] Written normal spreadsheet to:", normal_key)
|
||||
|
||||
# Write reference tools to reference-tools
|
||||
ref_key = f"{config._bl}:reference-tools"
|
||||
if reference_short_infos:
|
||||
ref_list = SampleShortInfoList(s=reference_short_infos)
|
||||
config._client.set(ref_key, ref_list.model_dump_json())
|
||||
config.redis.set(ref_key, ref_list.model_dump_json())
|
||||
print("[REDIS][INFO] Written reference tools to:", ref_key)
|
||||
else:
|
||||
# Clear key if empty
|
||||
try:
|
||||
config._client.delete(ref_key)
|
||||
config.redis.delete(ref_key)
|
||||
print("[REDIS][INFO] Cleared reference tools key:", ref_key)
|
||||
except Exception:
|
||||
logger.debug("Could not clear the reference tools key", exc_info=True)
|
||||
|
||||
Reference in New Issue
Block a user