diff --git a/sf_daq_broker/broker_manager.py b/sf_daq_broker/broker_manager.py index aadb834..e58cdca 100644 --- a/sf_daq_broker/broker_manager.py +++ b/sf_daq_broker/broker_manager.py @@ -149,7 +149,7 @@ class BrokerManager: detector_name = request.get("detector_name", None) validate.detector_name(detector_name) - validate.detector_name_in_allowed_detectors_beamline(detector_name, allowed_detectors_beamline) + validate.detector_name_in_allowed_detectors_beamline(detector_name, allowed_detectors_beamline, beamline) request_power_on = { "detector_name": detector_name, @@ -245,7 +245,7 @@ class BrokerManager: detectors = list(request["detectors"]) validate.detectors(detectors) - validate.all_detector_names_in_allowed_detectors_beamline(detectors, allowed_detectors_beamline) + validate.all_detector_names_in_allowed_detectors_beamline(detectors, allowed_detectors_beamline, beamline) validate.request_has_pgroup(request) pgroup = request["pgroup"] @@ -388,7 +388,7 @@ class BrokerManager: if detectors: allowed_detectors_beamline = configured_detectors_for_beamline(beamline) validate.allowed_detectors_beamline(allowed_detectors_beamline) - validate.all_detector_names_in_allowed_detectors_beamline(detectors, allowed_detectors_beamline) + validate.all_detector_names_in_allowed_detectors_beamline(detectors, allowed_detectors_beamline, beamline) if "channels_list" in request: request["channels_list"] = list(dict.fromkeys(request["channels_list"])) diff --git a/sf_daq_broker/broker_manager_slow.py b/sf_daq_broker/broker_manager_slow.py index 5f40d5d..e426eb2 100644 --- a/sf_daq_broker/broker_manager_slow.py +++ b/sf_daq_broker/broker_manager_slow.py @@ -50,7 +50,7 @@ class DetectorManager: detector_name = request.get("detector_name", None) validate.detector_name(detector_name) - validate.detector_name_in_allowed_detectors_beamline(detector_name, allowed_detectors_beamline) + validate.detector_name_in_allowed_detectors_beamline(detector_name, allowed_detectors_beamline, beamline) detector_number = int(detector_name[2:4]) detector = Jungfrau(detector_number) @@ -84,7 +84,7 @@ class DetectorManager: detector_name = request.get("detector_name", None) validate.detector_name(detector_name) - validate.detector_name_in_allowed_detectors_beamline(detector_name, allowed_detectors_beamline) + validate.detector_name_in_allowed_detectors_beamline(detector_name, allowed_detectors_beamline, beamline) detector_number = int(detector_name[2:4]) detector = Jungfrau(detector_number) @@ -211,7 +211,7 @@ class DetectorManager: detector_name = request.get("detector_name", None) validate.detector_name(detector_name) - validate.detector_name_in_allowed_detectors_beamline(detector_name, allowed_detectors_beamline) + validate.detector_name_in_allowed_detectors_beamline(detector_name, allowed_detectors_beamline, beamline) dap_parameters_file = f"/gpfs/photonics/swissfel/buffer/dap/config/pipeline_parameters.{detector_name}.json" validate.dap_parameters_file_exists(dap_parameters_file) @@ -234,7 +234,7 @@ class DetectorManager: detector_name = request.get("detector_name", None) validate.detector_name(detector_name) - validate.detector_name_in_allowed_detectors_beamline(detector_name, allowed_detectors_beamline) + validate.detector_name_in_allowed_detectors_beamline(detector_name, allowed_detectors_beamline, beamline) dap_parameters_file = f"/gpfs/photonics/swissfel/buffer/dap/config/pipeline_parameters.{detector_name}.json" validate.dap_parameters_file_exists(dap_parameters_file) diff --git a/sf_daq_broker/validate.py b/sf_daq_broker/validate.py index e5bd3ca..2bf5f6c 100644 --- a/sf_daq_broker/validate.py +++ b/sf_daq_broker/validate.py @@ -63,13 +63,13 @@ def pgroup_is_not_closed(dd, ptp): if os.path.exists(f"{dd}/CLOSED"): raise RuntimeError(f"{ptp} is closed for writing") -def detector_name_in_allowed_detectors_beamline(dn, adb): +def detector_name_in_allowed_detectors_beamline(dn, adb, bl): if dn not in adb: - raise RuntimeError(f"{dn} not belongs to the {beamline}") + raise RuntimeError(f"{dn} not belongs to the {bl}") -def all_detector_names_in_allowed_detectors_beamline(dns, adb): +def all_detector_names_in_allowed_detectors_beamline(dns, adb, bl): for dn in dns: - detector_name_in_allowed_detectors_beamline(dn, adb) + detector_name_in_allowed_detectors_beamline(dn, adb, bl) def request_has_detectors(req): if "detectors" not in req: