From ebd1c7c94b322daf576d68a9558a8b913f8a7460 Mon Sep 17 00:00:00 2001 From: Philipp Schmidt <philipp.schmidt@xfel.eu> Date: Mon, 13 Feb 2023 15:31:24 +0100 Subject: [PATCH] Fix update_config to actually allow updating config of non-AGIPD detectors --- webservice/update_config.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/webservice/update_config.py b/webservice/update_config.py index f6a6f9d1f..f79110b39 100755 --- a/webservice/update_config.py +++ b/webservice/update_config.py @@ -40,7 +40,7 @@ AGIPD_CONFIGURATIONS = { } } -DATA_MAPPING = { +AGIPD_DATA_MAPPING = { "karabo-da": { 'type': list, 'choices': [f"AGIPD{i:02d}" for i in range(16)], @@ -48,9 +48,17 @@ DATA_MAPPING = { } } +REMI_DATA_MAPPING = { + "karabo-da": { + 'type': list, + 'choices': ['DIGI02'], + 'msg': "Choices: [DIGI02]. " + } +} + AVAILABLE_DETECTORS = { - "SPB_DET_AGIPD1M-1": [AGIPD_CONFIGURATIONS, DATA_MAPPING], - "MID_DET_AGIPD1M-1": [AGIPD_CONFIGURATIONS, DATA_MAPPING], + "SPB_DET_AGIPD1M-1": [AGIPD_CONFIGURATIONS, AGIPD_DATA_MAPPING], + "MID_DET_AGIPD1M-1": [AGIPD_CONFIGURATIONS, AGIPD_DATA_MAPPING], } @@ -67,7 +75,7 @@ required_args = parser.add_argument_group('required arguments') required_args.add_argument( '--karabo-id', type=str, - choices=['SPB_DET_AGIPD1M-1', 'MID_DET_AGIPD1M-1']) + choices=list(AVAILABLE_DETECTORS.keys())) required_args.add_argument( '--proposal', type=str, help='The proposal number, without leading p, but with leading zeros.') @@ -105,7 +113,7 @@ def _add_available_configs_to_arg_parser(karabo_id: str, action: str): along with the arguments. """ - available_conf = [{}, DATA_MAPPING] + available_conf = [{}, AVAILABLE_DETECTORS[karabo_id][1]] # adding "no" bools to available configurations # Loop over action configurations in available_detectors dictionary. @@ -175,7 +183,7 @@ def _create_new_config_from_args_input( continue # checking if data-mapping was updated. - if key in DATA_MAPPING.keys(): + if key in AVAILABLE_DETECTORS[karabo_id][1].keys(): if 'data-mapping' not in new_conf.keys(): new_conf['data-mapping'] = {karabo_id: {key: {}}} new_conf['data-mapping'][karabo_id][key] = value -- GitLab