From 02cfbde47043b694d68a012501d568b065909728 Mon Sep 17 00:00:00 2001 From: appleb_m Date: Mon, 27 Apr 2026 17:08:08 +0200 Subject: [PATCH] gitea workflows: tellupdater dependendency on mx_beamline() moved to if __name__=="main". and put if name is None: return MXBeamline.SIMULATED. --- src/aare/common/beamline.py | 2 ++ src/aare/daq/tellupdater.py | 28 ++++++++++++++-------------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/aare/common/beamline.py b/src/aare/common/beamline.py index 7c402bb8..e448fcff 100644 --- a/src/aare/common/beamline.py +++ b/src/aare/common/beamline.py @@ -11,5 +11,7 @@ class MXBeamline(Enum): def mx_beamline() -> MXBeamline: name = os.getenv("BEAMLINE") + if name is None: + return MXBeamline.SIMULATED name=name.strip().upper() return MXBeamline[name] if name in MXBeamline.__members__ else MXBeamline.SIMULATED diff --git a/src/aare/daq/tellupdater.py b/src/aare/daq/tellupdater.py index 7c37f3e2..8a18a77a 100644 --- a/src/aare/daq/tellupdater.py +++ b/src/aare/daq/tellupdater.py @@ -15,20 +15,6 @@ from aare.common.beamline import MXBeamline, mx_beamline logger = setup_logger("aareDAQ") -# Configuration -beamline = mx_beamline() -SLOT_IDENTIFIER = beamline.value.upper() -#WS_URL = f"wss://mx-db-01.psi.ch/dispatcher/protected_router/wstell/ws/slot/{SLOT_IDENTIFIER}" -WS_URL = f"wss://mx-aaredb-dmz-01.psi.ch/dispatcher/protected_router/wstell/ws/slot/{SLOT_IDENTIFIER}" -#WS_URL = f"wss://localhost:8001/protected_router/wstell/ws/slot/{SLOT_IDENTIFIER}" -WS_HEADERS = [f"X-Shared-Password: {os.getenv('AAREDB_SHARED_PASSWORD')}"] -print(WS_HEADERS) - -# Initialize TELL client and DB wrapper - # Use your beamline enum/value -tell_client = TellClient(bl=beamline) -aare_db = AareWrapper(bl=beamline) - # Track current state current_pucks = [] last_pucks_sent = [] @@ -209,4 +195,18 @@ def main(): time.sleep(5) if __name__ == "__main__": + # Configuration + + beamline = mx_beamline() + SLOT_IDENTIFIER = beamline.value.upper() + # WS_URL = f"wss://mx-db-01.psi.ch/dispatcher/protected_router/wstell/ws/slot/{SLOT_IDENTIFIER}" + WS_URL = f"wss://mx-aaredb-dmz-01.psi.ch/dispatcher/protected_router/wstell/ws/slot/{SLOT_IDENTIFIER}" + # WS_URL = f"wss://localhost:8001/protected_router/wstell/ws/slot/{SLOT_IDENTIFIER}" + WS_HEADERS = [f"X-Shared-Password: {os.getenv('AAREDB_SHARED_PASSWORD')}"] + print(WS_HEADERS) + + # Initialize TELL client and DB wrapper + # Use your beamline enum/value + tell_client = TellClient(bl=beamline) + aare_db = AareWrapper(bl=beamline) main()