diff --git a/tangostationcontrol/tangostationcontrol/toolkit/archiver.py b/tangostationcontrol/tangostationcontrol/toolkit/archiver.py index 60595b3b73c22b18cb8965f16f500b9f47392aad..dab6e15c6209dba7d662c11b4f594f30d8c36ebf 100644 --- a/tangostationcontrol/tangostationcontrol/toolkit/archiver.py +++ b/tangostationcontrol/tangostationcontrol/toolkit/archiver.py @@ -154,9 +154,11 @@ class Archiver(): # Add the attribute to the archiver setting either specific or global parameters self.add_attribute_to_archiver(att_fqname, dev_polling_time, archive_period or dev_archive_period, dev_strategy, abs_change or dev_archive_abs_change, rel_change or dev_archive_rel_change) - except Exception as e: + except DevFailed as e: if 'already subscribed' in str(e): logger.warning(f"Multiple entries of Attribute {device}'/'{att} in config file") + else: + raise def configure_for_production(self, config_dict:dict, device:str): """ @@ -185,9 +187,11 @@ class Archiver(): for att in exclude_att_list: att_fqname = attribute_fqdn(f"{device}/{att}") self.remove_attribute_from_archiver(att_fqname) - except Exception as e: + except DevFailed as e: if 'already subscribed' in str(e): logger.warning(f"Multiple entries of Attribute {device}'/'{att} in config file") + else: + raise def add_event_subscriber(self, es_name:str=None): """ diff --git a/tangostationcontrol/tangostationcontrol/toolkit/archiver_configurator.py b/tangostationcontrol/tangostationcontrol/toolkit/archiver_configurator.py index 739c53994c15902f31a2a50ed0c279bda5b95a71..848d236419b78ee5f0ce1c1f8f4eb7d145e1e134 100644 --- a/tangostationcontrol/tangostationcontrol/toolkit/archiver_configurator.py +++ b/tangostationcontrol/tangostationcontrol/toolkit/archiver_configurator.py @@ -2,7 +2,7 @@ """ -Functions related to the managing of archiver configuration JSON file +Functions related to the managing of the archiver configuration JSON file """ import logging @@ -11,7 +11,9 @@ from tangostationcontrol.toolkit.archiver_util import get_attributes_from_suffix logger = logging.getLogger() def _get_archiving_parameters(attribute:str): - """Helper function that returns four archiving parameters defined in a JSON file""" + """Helper function that returns the following archiving parameters defined in a JSON file: + archive period [ms], event period [ms], absolute change, relative change + """ archive_period = int(attribute['archive_period']) event_period = int(attribute['event_period']) abs_change = attribute['abs_change'] and int(attribute['abs_change']) @@ -20,7 +22,8 @@ def _get_archiving_parameters(attribute:str): def get_parameters_from_attribute(device_name:str, attribute_name:str, config_dict:dict, environment: str): """ - Return the archiving parameters defined in the configuration file for a certain attribute + Return the archiving parameters ( see ref.: '_get_archiving_parameters' ) + defined in the configuration file for a certain attribute """ if environment == 'development': # Search if the attribute parameters are listed inside the device configuration @@ -64,7 +67,9 @@ def get_exclude_attribute_list(device:str, config_dict:dict): return exclude_att_list def get_global_env_parameters(config_dict:dict, environment:str): - """Return the archiving parameters defined in the 'global_variable' section of the JSON configuration file""" + """Return the following archiving parameters defined in the 'global_variable' section of the JSON configuration file: + polling time [ms], absolute change, relative change, archive period [ms], event period [ms] and strategy + """ var_dict = config_dict['_global_variables'] # Archiving parameters retrieved from JSON file polling_time = int(var_dict[environment]['polling_time'])