Skip to content
Snippets Groups Projects
Commit b6b35c96 authored by Stefano Di Frischia's avatar Stefano Di Frischia
Browse files

Minor bugs fixing

parent 9b47f0d8
No related branches found
No related tags found
1 merge request!133Resolve L2SS-362 "Switch env mode"
......@@ -217,14 +217,11 @@ class Archiver():
"""
Update the archiving properties of an attribute already in a subscriber list
"""
try:
self.remove_attribute_from_archiver(attribute_name)
time.sleep(1)
self.add_attribute_to_archiver(attribute_name,polling_period,event_period,strategy)
time.sleep(1)
self.start_archiving_attribute(attribute_name)
except Exception as e:
raise Exception from e
def get_subscriber_attributes(self,es_name:str = None):
"""
......@@ -353,7 +350,7 @@ class Retriever():
try:
[domain, family, member] = device_fqname.split('/')
except:
raise AttributeFormatException
raise AttributeFormatException(f"Could not parse device name {device_fqname}. Please provide FQDN, e.g. LTS/Device/1")
attrs = self.session.query(Attribute).filter(and_(Attribute.domain == domain, Attribute.family == family, \
Attribute.member == member)).all()
# Returns the representation as set in __repr__ method of the mapper class
......@@ -366,7 +363,7 @@ class Retriever():
try:
[domain, family, member, name] = attribute_fqname.split('/')
except:
raise AttributeFormatException
raise AttributeFormatException(f"Could not parse attribute name {attribute_fqname}. Please provide FQDN, e.g. LTS/Device/1/Attribute")
try:
result = self.session.query(Attribute.att_conf_id).filter(and_(Attribute.domain == domain, Attribute.family == family, \
Attribute.member == member, Attribute.name == name)).one()
......@@ -385,7 +382,7 @@ class Retriever():
try:
[domain, family, member, name] = attribute_fqname.split('/')
except:
raise AttributeFormatException
raise AttributeFormatException(f"Could not parse attribute name {attribute_fqname}. Please provide FQDN, e.g. LTS/Device/1/Attribute")
try:
result = self.session.query(DataType.data_type).join(Attribute,Attribute.att_conf_data_type_id==DataType.att_conf_data_type_id).\
filter(and_(Attribute.domain == domain, Attribute.family == family, Attribute.member == member, Attribute.name == name)).one()
......@@ -419,8 +416,6 @@ class Retriever():
base_class.data_time <= time_now_db)).order_by(base_class.data_time).all()
except AttributeError as e:
raise Exception(f"Empty result! Attribute {attribute_fqname} not found") from e
except Exception as e:
raise Exception from e
return result
def get_attribute_value_by_interval(self,attribute_fqname: str, start_time: datetime, stop_time: datetime):
......@@ -441,7 +436,5 @@ class Retriever():
base_class.data_time <= str(stop_time))).order_by(base_class.data_time).all()
except AttributeError as e:
raise Exception(f"Empty result! Attribute {attribute_fqname} not found") from e
except Exception as e:
raise Exception from e
return result
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment