Loading csp-lmc-common/csp_lmc_common/CspCapabilityMonitor.py +30 −23 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ from tango.server import run from tango.server import attribute, command from tango.server import device_property from tango import AttrQuality, DispLevel, DevState from tango import AttrWriteType, PipeWriteType from tango import AttrWriteType, EventType # Additional import # PROTECTED REGION ID(CspCapabilityMonitor.additionnal_import) ENABLED START # from ska.base import SKABaseDevice Loading Loading @@ -156,6 +156,7 @@ class CspCapabilityMonitor(SKABaseDevice): # connect to DB and read the adminMode of each capability for fqdn in self.CapabilityDevices: self._event_id[fqdn] = [] attribute_properties = self._csp_tango_db.get_device_attribute_property(fqdn, {'adminMode': ['__value'],}) try: admin_mode_memorized = attribute_properties['adminMode']['__value'] Loading @@ -169,31 +170,31 @@ class CspCapabilityMonitor(SKABaseDevice): EventType.CHANGE_EVENT, self._attributes_change_event_cb, stateless=True) self._event_id[fqdn] = ev_id self._event_id[fqdn].append(ev_id) ev_id = device_proxy.subscribe_event("State", EventType.CHANGE_EVENT, self._attributes_change_event_cb, stateless=True) self._event_id[fqdn] = ev_id self._event_id[fqdn].append(ev_id) ev_id = device_proxy.subscribe_event("healthState", EventType.CHANGE_EVENT, self._attributes_change_event_cb, stateless=True) self._event_id[fqdn] = ev_id self._event_id[fqdn].append(ev_id) ev_id = device_proxy.subscribe_event("obsState", EventType.CHANGE_EVENT, self._attributes_change_event_cb, stateless=True) self._event_id[fqdn]= ev_id self._event_id[fqdn].append(ev_id) ev_id = device_proxy.subscribe_event("subarrayMemebership", EventType.CHANGE_EVENT, self._attributes_change_event_cb, stateless=True) self._event_id[fqdn]['subarrayMembership'] = ev_id self._event_id[fqdn].append(ev_id) except tango.DevFailed as tango_err: self.logger.warn("_connect_to_capability: {}.".format(tango_err.args[0].desc)) Loading Loading @@ -251,25 +252,31 @@ class CspCapabilityMonitor(SKABaseDevice): destructor and by the device Init command. """ # PROTECTED REGION ID(CspCapabilityMonitor.delete_device) ENABLED START # event_to_remove = [] for fqdn in self._capability_fqdn: event_to_remove = [] try: self._capability_proxies[fqdn].unsubscribe_event(self._event_id[fqdn]) event_to_remove.append(fqdn) for ev_id in self._event_id[fqdn]: try: self._capability_proxies[fqdn].unsubscribe_event(ev_id) event_to_remove.append(ev_id) except KeyError as key_err: msg = ("Failure unsubscribing event {} " "on device {}. Reason: {}".format(event_id, "on device {}. Reason: {}".format(ev_id, fqdn, key_err)) self.logger.error(msg) # remove the events id from the list for k in _event_id[fqdn].remove(k): for k in event_to_remove: self._event_id[fqdn].remove(k) if self._event_id[fqdn]: msg = "Still subscribed events: {}".format(self._event_id) self.logger.warn(msg) else: # remove the dictionary element self._event_id.pop(fqdn) except KeyError as key_err: msg = " Can't retrieve the information of key {}".format(key_err) self.loggerr.error(msg) self._capability_fqdn.clear() self._capability_state.clear() Loading csp-lmc-common/csp_lmc_common/CspSearchBeamCapability.py +2 −2 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ Used for development of LOW and MID specific devices. # PROTECTED REGION ID (CspSearchBeamCapability.standardlibray_import) ENABLED START # # Python standard library # PROTECTED REGION END# //CspSearchBeamCapability.standardlibray_import # PyTango imports # tango imports import tango from tango import DebugIt from tango.server import run Loading Loading @@ -162,7 +162,7 @@ class CspSearchBeamCapability(SKACapability): def read_pssPipelineState(self): # PROTECTED REGION ID(CspSearchBeamCapability.pssPipelineState_read) ENABLED START # """Return the pssPipelineState attribute.""" return PyTango.DevState.UNKNOWN return tango.DevState.UNKNOWN # PROTECTED REGION END # // CspSearchBeamCapability.pssPipelineState_read def read_pssPipelineAdminMode(self): Loading csp-lmc-common/csp_lmc_common/CspSearchBeamsMonitor.py +1 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ from tango import AttrWriteType, PipeWriteType # Additional import # PROTECTED REGION ID(CspSearchBeamsMonitor.additionnal_import) ENABLED START # from ska.base.control_model import HealthState, AdminMode, ObsState, ObsMode from csp_lmc_common.CspCapabilityMonitor import CspCapabilityMonitor from .CspCapabilityMonitor import CspCapabilityMonitor # PROTECTED REGION END # // CspSearchBeamsMonitor.additionnal_import __all__ = ["CspSearchBeamsMonitor", "main"] Loading csp-lmc-common/csp_lmc_common/CspSubarray.py +1 −1 Original line number Diff line number Diff line Loading @@ -2002,7 +2002,7 @@ class CspSubarray(SKASubarray): self._sc_subarray_cmd_exec_state[device]['configurescan'] = CmdExecState.FAILED # register the starting time for the command self._sc_subarray_cmd_starting_time[device] = time.time() self.logger.debug("configure starting time:", self._sc_subarray_cmd_starting_time[device]) self.logger.debug("configure starting time: {}".format(self._sc_subarray_cmd_starting_time[device])) #self._obs_state = ObsState.CONFIGURING self._cmd_execution_state['configurescan'] = CmdExecState.RUNNING # invoke the constructor for the command thread Loading csp-lmc-common/csp_lmc_common/CspSubarrayProcModeCorrelation.py +1 −1 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ from tango import AttrQuality, DispLevel, DevState from tango import AttrWriteType, PipeWriteType # Additional import # PROTECTED REGION ID(CspSubarrayProcModeCorrelation.additionnal_import) ENABLED START # from csp_lmc_common.CspSubarrayInherentCapability import CspSubarrayInherentCapability from .CspSubarrayInherentCapability import CspSubarrayInherentCapability # PROTECTED REGION END # // CspSubarrayProcModeCorrelation.additionnal_import __all__ = ["CspSubarrayProcModeCorrelation", "main"] Loading Loading
csp-lmc-common/csp_lmc_common/CspCapabilityMonitor.py +30 −23 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ from tango.server import run from tango.server import attribute, command from tango.server import device_property from tango import AttrQuality, DispLevel, DevState from tango import AttrWriteType, PipeWriteType from tango import AttrWriteType, EventType # Additional import # PROTECTED REGION ID(CspCapabilityMonitor.additionnal_import) ENABLED START # from ska.base import SKABaseDevice Loading Loading @@ -156,6 +156,7 @@ class CspCapabilityMonitor(SKABaseDevice): # connect to DB and read the adminMode of each capability for fqdn in self.CapabilityDevices: self._event_id[fqdn] = [] attribute_properties = self._csp_tango_db.get_device_attribute_property(fqdn, {'adminMode': ['__value'],}) try: admin_mode_memorized = attribute_properties['adminMode']['__value'] Loading @@ -169,31 +170,31 @@ class CspCapabilityMonitor(SKABaseDevice): EventType.CHANGE_EVENT, self._attributes_change_event_cb, stateless=True) self._event_id[fqdn] = ev_id self._event_id[fqdn].append(ev_id) ev_id = device_proxy.subscribe_event("State", EventType.CHANGE_EVENT, self._attributes_change_event_cb, stateless=True) self._event_id[fqdn] = ev_id self._event_id[fqdn].append(ev_id) ev_id = device_proxy.subscribe_event("healthState", EventType.CHANGE_EVENT, self._attributes_change_event_cb, stateless=True) self._event_id[fqdn] = ev_id self._event_id[fqdn].append(ev_id) ev_id = device_proxy.subscribe_event("obsState", EventType.CHANGE_EVENT, self._attributes_change_event_cb, stateless=True) self._event_id[fqdn]= ev_id self._event_id[fqdn].append(ev_id) ev_id = device_proxy.subscribe_event("subarrayMemebership", EventType.CHANGE_EVENT, self._attributes_change_event_cb, stateless=True) self._event_id[fqdn]['subarrayMembership'] = ev_id self._event_id[fqdn].append(ev_id) except tango.DevFailed as tango_err: self.logger.warn("_connect_to_capability: {}.".format(tango_err.args[0].desc)) Loading Loading @@ -251,25 +252,31 @@ class CspCapabilityMonitor(SKABaseDevice): destructor and by the device Init command. """ # PROTECTED REGION ID(CspCapabilityMonitor.delete_device) ENABLED START # event_to_remove = [] for fqdn in self._capability_fqdn: event_to_remove = [] try: self._capability_proxies[fqdn].unsubscribe_event(self._event_id[fqdn]) event_to_remove.append(fqdn) for ev_id in self._event_id[fqdn]: try: self._capability_proxies[fqdn].unsubscribe_event(ev_id) event_to_remove.append(ev_id) except KeyError as key_err: msg = ("Failure unsubscribing event {} " "on device {}. Reason: {}".format(event_id, "on device {}. Reason: {}".format(ev_id, fqdn, key_err)) self.logger.error(msg) # remove the events id from the list for k in _event_id[fqdn].remove(k): for k in event_to_remove: self._event_id[fqdn].remove(k) if self._event_id[fqdn]: msg = "Still subscribed events: {}".format(self._event_id) self.logger.warn(msg) else: # remove the dictionary element self._event_id.pop(fqdn) except KeyError as key_err: msg = " Can't retrieve the information of key {}".format(key_err) self.loggerr.error(msg) self._capability_fqdn.clear() self._capability_state.clear() Loading
csp-lmc-common/csp_lmc_common/CspSearchBeamCapability.py +2 −2 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ Used for development of LOW and MID specific devices. # PROTECTED REGION ID (CspSearchBeamCapability.standardlibray_import) ENABLED START # # Python standard library # PROTECTED REGION END# //CspSearchBeamCapability.standardlibray_import # PyTango imports # tango imports import tango from tango import DebugIt from tango.server import run Loading Loading @@ -162,7 +162,7 @@ class CspSearchBeamCapability(SKACapability): def read_pssPipelineState(self): # PROTECTED REGION ID(CspSearchBeamCapability.pssPipelineState_read) ENABLED START # """Return the pssPipelineState attribute.""" return PyTango.DevState.UNKNOWN return tango.DevState.UNKNOWN # PROTECTED REGION END # // CspSearchBeamCapability.pssPipelineState_read def read_pssPipelineAdminMode(self): Loading
csp-lmc-common/csp_lmc_common/CspSearchBeamsMonitor.py +1 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ from tango import AttrWriteType, PipeWriteType # Additional import # PROTECTED REGION ID(CspSearchBeamsMonitor.additionnal_import) ENABLED START # from ska.base.control_model import HealthState, AdminMode, ObsState, ObsMode from csp_lmc_common.CspCapabilityMonitor import CspCapabilityMonitor from .CspCapabilityMonitor import CspCapabilityMonitor # PROTECTED REGION END # // CspSearchBeamsMonitor.additionnal_import __all__ = ["CspSearchBeamsMonitor", "main"] Loading
csp-lmc-common/csp_lmc_common/CspSubarray.py +1 −1 Original line number Diff line number Diff line Loading @@ -2002,7 +2002,7 @@ class CspSubarray(SKASubarray): self._sc_subarray_cmd_exec_state[device]['configurescan'] = CmdExecState.FAILED # register the starting time for the command self._sc_subarray_cmd_starting_time[device] = time.time() self.logger.debug("configure starting time:", self._sc_subarray_cmd_starting_time[device]) self.logger.debug("configure starting time: {}".format(self._sc_subarray_cmd_starting_time[device])) #self._obs_state = ObsState.CONFIGURING self._cmd_execution_state['configurescan'] = CmdExecState.RUNNING # invoke the constructor for the command thread Loading
csp-lmc-common/csp_lmc_common/CspSubarrayProcModeCorrelation.py +1 −1 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ from tango import AttrQuality, DispLevel, DevState from tango import AttrWriteType, PipeWriteType # Additional import # PROTECTED REGION ID(CspSubarrayProcModeCorrelation.additionnal_import) ENABLED START # from csp_lmc_common.CspSubarrayInherentCapability import CspSubarrayInherentCapability from .CspSubarrayInherentCapability import CspSubarrayInherentCapability # PROTECTED REGION END # // CspSubarrayProcModeCorrelation.additionnal_import __all__ = ["CspSubarrayProcModeCorrelation", "main"] Loading