diff --git a/devices/toolkit/archiver.py b/devices/toolkit/archiver.py index 0991b05c6fac220a786b90bc922032f130785c12..9f77bc39efe60ccfc9f94f72d6060fd44dc92e61 100644 --- a/devices/toolkit/archiver.py +++ b/devices/toolkit/archiver.py @@ -276,6 +276,20 @@ class Archiver(): else: return len(es.AttributeList or []) + def get_attribute_freq(self,attribute_name:str): + """ + Return the attribute archiving frequency in events/minute + """ + if (len(attribute_name.split('/'))!=4): + raise AttributeFormatException + if self.is_attribute_archived(attribute_name): + freq_dict = dict((a,r) for a,r in zip(self.es.AttributeList,self.es.AttributeRecordFreqList)) + for f in freq_dict: + if attribute_name in f: + return freq_dict.get(f,0.) + else: + logger.warning(f"Attribute {attribute_name} not found!") + class AttributeFormatException(Exception): """ Exception that handles wrong attribute naming