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

L2SS-691: add image classes in archiver base

parent 377ae89a
No related branches found
No related tags found
1 merge request!281Resolve L2SS-691 "Image support for timescaledb"
This diff is collapsed.
...@@ -25,7 +25,7 @@ def warn_if_attribute_not_found(): ...@@ -25,7 +25,7 @@ def warn_if_attribute_not_found():
try: try:
return func(self, attribute_name, *args, **kwargs) return func(self, attribute_name, *args, **kwargs)
except DevFailed as e: except DevFailed as e:
if e.args[0].reason == 'Attribute not found': if e.args[0].reason == 'Attribute not found' or 'NOT FOUND in signal list':
logger.warning(f"Attribute {attribute_name} not found!") logger.warning(f"Attribute {attribute_name} not found!")
else: else:
raise raise
...@@ -168,8 +168,8 @@ class Archiver(): ...@@ -168,8 +168,8 @@ class Archiver():
environment = 'production' environment = 'production'
# Retrieve global parameters # Retrieve global parameters
prod_polling_time, prod_archive_abs_change, prod_archive_rel_change, prod_archive_period, prod_event_period, prod_strategy = get_global_env_parameters(config_dict, environment) prod_polling_time, prod_archive_abs_change, prod_archive_rel_change, prod_archive_period, prod_event_period, prod_strategy = get_global_env_parameters(config_dict, environment)
# Cleanup the subscriber # TODO Cleanup the subscriber
self.remove_attributes_by_device(device) # self.remove_attributes_by_device(device)
attribute_list = DeviceProxy(device).get_attribute_list() attribute_list = DeviceProxy(device).get_attribute_list()
try: try:
# Add attributes in 'suffixes' and 'infixes' list which have different parameters # Add attributes in 'suffixes' and 'infixes' list which have different parameters
...@@ -214,6 +214,7 @@ class Archiver(): ...@@ -214,6 +214,7 @@ class Archiver():
else: else:
raise raise
@warn_if_attribute_not_found()
def add_attribute_to_archiver(self, attribute_name: str, polling_period: int, archive_event_period: int, strategy: str = 'RUN', def add_attribute_to_archiver(self, attribute_name: str, polling_period: int, archive_event_period: int, strategy: str = 'RUN',
abs_change: int = 1, rel_change: int = None, es_name:str=None): abs_change: int = 1, rel_change: int = None, es_name:str=None):
""" """
......
...@@ -418,6 +418,19 @@ class Array_Boolean(Array): ...@@ -418,6 +418,19 @@ class Array_Boolean(Array):
def __repr__(self): def __repr__(self):
return f"<Array_Boolean(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>" return f"<Array_Boolean(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>"
class Image_Boolean(Array):
"""
Class that represents a Tango Boolean Image mapped to table 'att_image_devboolean'
"""
__tablename__ = 'att_image_devboolean'
__table_args__ = {'extend_existing': True}
value_r = Column(ARRAY(Boolean))
value_w = Column(ARRAY(Boolean))
def __repr__(self):
return f"<Image_Boolean(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>"
class Array_Double(Array): class Array_Double(Array):
""" """
Class that represents a Tango Double Array mapped to table 'att_array_devdouble' Class that represents a Tango Double Array mapped to table 'att_array_devdouble'
...@@ -430,6 +443,18 @@ class Array_Double(Array): ...@@ -430,6 +443,18 @@ class Array_Double(Array):
def __repr__(self): def __repr__(self):
return f"<Array_Double(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>" return f"<Array_Double(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>"
class Image_Double(Array):
"""
Class that represents a Tango Double Image mapped to table 'att_image_devdouble'
"""
__tablename__ = 'att_image_devdouble'
__table_args__ = {'extend_existing': True}
value_r = Column(ARRAY(FLOAT))
value_w = Column(ARRAY(FLOAT))
def __repr__(self):
return f"<Image_Double(att_conf_id='{self.att_conf_id}', data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>"
class Array_Encoded(Array): class Array_Encoded(Array):
""" """
Class that represents a Tango Encoded Array mapped to table 'att_array_devencoded' Class that represents a Tango Encoded Array mapped to table 'att_array_devencoded'
...@@ -442,6 +467,18 @@ class Array_Encoded(Array): ...@@ -442,6 +467,18 @@ class Array_Encoded(Array):
def __repr__(self): def __repr__(self):
return f"<Array_Encoded(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>" return f"<Array_Encoded(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>"
class Image_Encoded(Array):
"""
Class that represents a Tango Encoded Array mapped to table 'att_image_devencoded'
"""
__tablename__ = 'att_image_devencoded'
__table_args__ = {'extend_existing': True}
value_r = Column(ARRAY(BYTEA))
value_w = Column(ARRAY(BYTEA))
def __repr__(self):
return f"<Image_Encoded(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>"
class Array_Enum(Array): class Array_Enum(Array):
""" """
Class that represents a Tango Enum Array mapped to table 'att_array_devenum' Class that represents a Tango Enum Array mapped to table 'att_array_devenum'
...@@ -456,6 +493,20 @@ class Array_Enum(Array): ...@@ -456,6 +493,20 @@ class Array_Enum(Array):
def __repr__(self): def __repr__(self):
return f"<Array_Enum(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r_label='{self.value_r_label}',value_r='{self.value_r}',value_w_label='{self.value_w_label}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>" return f"<Array_Enum(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r_label='{self.value_r_label}',value_r='{self.value_r}',value_w_label='{self.value_w_label}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>"
class Image_Enum(Array):
"""
Class that represents a Tango Enum Array mapped to table 'att_image_devenum'
"""
__tablename__ = 'att_image_devenum'
__table_args__ = {'extend_existing': True}
value_r_label = Column(ARRAY(TEXT))
value_r = Column(ARRAY(INTEGER))
value_w_label = Column(ARRAY(TEXT))
value_w = Column(ARRAY(INTEGER))
def __repr__(self):
return f"<Image_Enum(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r_label='{self.value_r_label}',value_r='{self.value_r}',value_w_label='{self.value_w_label}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>"
class Array_Float(Array): class Array_Float(Array):
""" """
Class that represents a Tango Float Array mapped to table 'att_array_devfloat' Class that represents a Tango Float Array mapped to table 'att_array_devfloat'
...@@ -468,6 +519,18 @@ class Array_Float(Array): ...@@ -468,6 +519,18 @@ class Array_Float(Array):
def __repr__(self): def __repr__(self):
return f"<Array_Float(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>" return f"<Array_Float(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>"
class Image_Float(Array):
"""
Class that represents a Tango Float Array mapped to table 'att_image_devfloat'
"""
__tablename__ = 'att_image_devfloat'
__table_args__ = {'extend_existing': True}
value_r = Column(ARRAY(FLOAT))
value_w = Column(ARRAY(FLOAT))
def __repr__(self):
return f"<Image_Float(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>"
class Array_Long(Array): class Array_Long(Array):
""" """
Class that represents a Tango Long Array mapped to table 'att_array_devlong' Class that represents a Tango Long Array mapped to table 'att_array_devlong'
...@@ -480,6 +543,18 @@ class Array_Long(Array): ...@@ -480,6 +543,18 @@ class Array_Long(Array):
def __repr__(self): def __repr__(self):
return f"<Array_Long(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>" return f"<Array_Long(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>"
class Image_Long(Array):
"""
Class that represents a Tango Long Array mapped to table 'att_image_devlong'
"""
__tablename__ = 'att_image_devlong'
__table_args__ = {'extend_existing': True}
value_r = Column(ARRAY(INT4RANGE))
value_w = Column(ARRAY(INT4RANGE))
def __repr__(self):
return f"<Image_Long(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>"
class Array_Long64(Array): class Array_Long64(Array):
""" """
Class that represents a Tango Long64 Array mapped to table 'att_array_devlong64' Class that represents a Tango Long64 Array mapped to table 'att_array_devlong64'
...@@ -492,6 +567,18 @@ class Array_Long64(Array): ...@@ -492,6 +567,18 @@ class Array_Long64(Array):
def __repr__(self): def __repr__(self):
return f"<Array_Long64(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>" return f"<Array_Long64(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>"
class Image_Long64(Array):
"""
Class that represents a Tango Long64 Array mapped to table 'att_image_devlong64'
"""
__tablename__ = 'att_image_devlong64'
__table_args__ = {'extend_existing': True}
value_r = Column(ARRAY(INT8RANGE))
value_w = Column(ARRAY(INT8RANGE))
def __repr__(self):
return f"<Image_Long64(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>"
class Array_Short(Array): class Array_Short(Array):
""" """
Class that represents a Tango Short Array mapped to table 'att_array_devshort' Class that represents a Tango Short Array mapped to table 'att_array_devshort'
...@@ -504,6 +591,18 @@ class Array_Short(Array): ...@@ -504,6 +591,18 @@ class Array_Short(Array):
def __repr__(self): def __repr__(self):
return f"<Array_Short(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>" return f"<Array_Short(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>"
class Image_Short(Array):
"""
Class that represents a Tango Short Array mapped to table 'att_image_devshort'
"""
__tablename__ = 'att_image_devshort'
__table_args__ = {'extend_existing': True}
value_r = Column(ARRAY(INTEGER))
value_w = Column(ARRAY(INTEGER))
def __repr__(self):
return f"<Image_Short(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>"
class Array_State(Array): class Array_State(Array):
""" """
Class that represents a Tango State Array mapped to table 'att_array_devstate' Class that represents a Tango State Array mapped to table 'att_array_devstate'
...@@ -516,6 +615,18 @@ class Array_State(Array): ...@@ -516,6 +615,18 @@ class Array_State(Array):
def __repr__(self): def __repr__(self):
return f"<Array_State(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>" return f"<Array_State(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>"
class Image_State(Array):
"""
Class that represents a Tango State Array mapped to table 'att_image_devstate'
"""
__tablename__ = 'att_image_devstate'
__table_args__ = {'extend_existing': True}
value_r = Column(ARRAY(INT4RANGE))
value_w = Column(ARRAY(INT4RANGE))
def __repr__(self):
return f"<Image_State(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>"
class Array_String(Array): class Array_String(Array):
""" """
Class that represents a Tango String Array mapped to table 'att_array_devstring' Class that represents a Tango String Array mapped to table 'att_array_devstring'
...@@ -528,6 +639,18 @@ class Array_String(Array): ...@@ -528,6 +639,18 @@ class Array_String(Array):
def __repr__(self): def __repr__(self):
return f"<Array_String(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>" return f"<Array_String(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>"
class Image_String(Array):
"""
Class that represents a Tango String Array mapped to table 'att_image_devstring'
"""
__tablename__ = 'att_image_devstring'
__table_args__ = {'extend_existing': True}
value_r = Column(ARRAY(TEXT))
value_w = Column(ARRAY(TEXT))
def __repr__(self):
return f"<Image_String(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>"
class Array_UChar(Array): class Array_UChar(Array):
""" """
Class that represents a Tango UChar Array mapped to table 'att_array_devuchar' Class that represents a Tango UChar Array mapped to table 'att_array_devuchar'
...@@ -540,6 +663,18 @@ class Array_UChar(Array): ...@@ -540,6 +663,18 @@ class Array_UChar(Array):
def __repr__(self): def __repr__(self):
return f"<Array_UChar(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>" return f"<Array_UChar(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>"
class Image_UChar(Array):
"""
Class that represents a Tango UChar Array mapped to table 'att_image_devuchar'
"""
__tablename__ = 'att_image_devuchar'
__table_args__ = {'extend_existing': True}
value_r = Column(ARRAY(INTEGER))
value_w = Column(ARRAY(INTEGER))
def __repr__(self):
return f"<Image_UChar(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>"
class Array_ULong(Array): class Array_ULong(Array):
""" """
Class that represents a Tango ULong Array mapped to table 'att_array_devulong' Class that represents a Tango ULong Array mapped to table 'att_array_devulong'
...@@ -552,6 +687,18 @@ class Array_ULong(Array): ...@@ -552,6 +687,18 @@ class Array_ULong(Array):
def __repr__(self): def __repr__(self):
return f"<Array_ULong(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>" return f"<Array_ULong(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>"
class Image_ULong(Array):
"""
Class that represents a Tango ULong Array mapped to table 'att_image_devulong'
"""
__tablename__ = 'att_image_devulong'
__table_args__ = {'extend_existing': True}
value_r = Column(ARRAY(INTEGER))
value_w = Column(ARRAY(INTEGER))
def __repr__(self):
return f"<Image_ULong(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>"
class Array_ULong64(Array): class Array_ULong64(Array):
""" """
Class that represents a Tango ULong64 Array mapped to table 'att_array_devulong64' Class that represents a Tango ULong64 Array mapped to table 'att_array_devulong64'
...@@ -564,6 +711,18 @@ class Array_ULong64(Array): ...@@ -564,6 +711,18 @@ class Array_ULong64(Array):
def __repr__(self): def __repr__(self):
return f"<Array_ULong64(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>" return f"<Array_ULong64(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>"
class Image_ULong64(Array):
"""
Class that represents a Tango ULong64 Array mapped to table 'att_image_devulong64'
"""
__tablename__ = 'att_image_devulong64'
__table_args__ = {'extend_existing': True}
value_r = Column(ARRAY(INTEGER))
value_w = Column(ARRAY(INTEGER))
def __repr__(self):
return f"<Image_ULong64(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>"
class Array_UShort(Array): class Array_UShort(Array):
""" """
Class that represents a Tango UShort Array mapped to table 'att_array_devushort' Class that represents a Tango UShort Array mapped to table 'att_array_devushort'
...@@ -576,6 +735,18 @@ class Array_UShort(Array): ...@@ -576,6 +735,18 @@ class Array_UShort(Array):
def __repr__(self): def __repr__(self):
return f"<Array_UShort(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>" return f"<Array_UShort(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>"
class Image_UShort(Array):
"""
Class that represents a Tango UShort Array mapped to table 'att_image_devushort'
"""
__tablename__ = 'att_image_devushort'
__table_args__ = {'extend_existing': True}
value_r = Column(ARRAY(INTEGER))
value_w = Column(ARRAY(INTEGER))
def __repr__(self):
return f"<Image_UShort(att_conf_id='{self.att_conf_id}',data_time='{self.data_time}',value_r='{self.value_r}',value_w='{self.value_w}',quality='{self.quality}',att_error_desc_id='{self.att_error_desc_id}',details='{self.details}')>"
def get_class_by_tablename(tablename: str): def get_class_by_tablename(tablename: str):
""" """
Returns class reference mapped to a table. Returns class reference mapped to a table.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment