Commit dea603fc authored by Elisabetta Giani's avatar Elisabetta Giani
Browse files

AT5-262: minor changes.

parent c3927775
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -151,7 +151,7 @@ class CspCapabilityMonitor(with_metaclass(DeviceMeta,SKABaseDevice)):
        try:
            admin_mode_memorized = attribute_properties['adminMode']['__value']
            self._admin_mode = int(admin_mode_memorized[0])
        except keyError as key_err:
        except KeyError as key_err:
            self.logger.info("No {} key found".format(str(key_err)))
        self._connect_to_capability()
        self._healthState = HealthState.OK
+7 −11
Original line number Diff line number Diff line
@@ -21,8 +21,7 @@ import threading
import time
# PROTECTED REGION END# //CspMaster.standardlibray_import

# tango imports# PROTECTED REGION ID (CspMaster.add_path) ENABLED START #

# tango imports
import tango
from tango import DebugIt
from tango.server import run
@@ -32,19 +31,15 @@ from tango.server import device_property
from tango import AttrQuality, EventType, DevState
from tango import AttrWriteType, DeviceProxy
# Additional import
# PROTECTED REGION ID(CspMaster.additionnal_import) ENABLED START #
# PROTECTED REGION ID(CspMaster.additional_import) ENABLED START #
#
from skabase.SKAMaster  import SKAMaster
from skabase.auxiliary import utils
# PROTECTED REGION END #    //  CspMaster.additionnal_import

# PROTECTED REGION ID (CspMaster.add_path) ENABLED START #
# add the path to import global_enum package.

from .utils.decorators import AdminModeCheck, CmdInputArgsCheck
from .utils.cspcommons import HealthState, AdminMode, ObsState, CmdExecState
from . import release
# PROTECTED REGION END# //CspMaster.add_path
# PROTECTED REGION END# //CspMaster.additional_import


__all__ = ["CspMaster", "main"]
@@ -506,8 +501,8 @@ class CspMaster(with_metaclass(DeviceMeta, SKAMaster)):
                        # command success: exit from the wait loop and issue the command
                        # on the next device in the list
                        break
                    # check for other sub-element device State values
                    if self._se_state[device] in [tango.DevState.FAULT, tango.DevState.ALARM]:
                    # check for other sub-element FAULT values
                    if self._se_state[device] == tango.DevState.FAULT:
                        self._se_cmd_execution_state[device][cmd_name] = CmdExecState.FAILED
                        self._alarm_message[cmd_name] += ("Device {} is {}".format(device, self.get_status()))
                        self.logger.warn(self._alarm_message[cmd_name]) 
@@ -523,6 +518,7 @@ class CspMaster(with_metaclass(DeviceMeta, SKAMaster)):
                    if self._se_cmd_execution_state[device][cmd_name] == CmdExecState.FAILED:
                        # execution ended for this sub-element, skip to the next one
                        num_of_failed_device += 1
                        # skip to next device
                        break
                    # check for timeout event. A timeout event can be detected in two ways:
                    # 1- the sub-element implements the 'onTimeoutExpired' attribute configured
@@ -1366,7 +1362,7 @@ class CspMaster(with_metaclass(DeviceMeta, SKAMaster)):
                        if event_id:
                            self._se_proxies[fqdn].unsubscribe_event(event_id)
                        event_to_remove[fqdn].append(attr_name)
                        # NOTE: in PyTango unsubscription of not-existing event
                        # NOTE: in tango unsubscription of not-existing event
                        # id raises a KeyError exception not a DevFailed !!
                    except KeyError as key_err:
                        msg = ("Failure unsubscribing event {} "
+8 −11
Original line number Diff line number Diff line
@@ -16,14 +16,13 @@ implemented in separate TANGO Devices.

# PROTECTED REGION ID (CspMaster.standardlibray_import) ENABLED START #
# Python standard library
from __future__ import absolute_import
import sys
import os
from future.utils import with_metaclass
from collections import defaultdict
# PROTECTED REGION END# //CspMaster.standardlibray_import

# tango imports# PROTECTED REGION ID (CspMaster.add_path) ENABLED START #
# tango imports

import tango
from tango import DebugIt
@@ -34,18 +33,14 @@ from tango.server import device_property
from tango import AttrQuality, EventType, DevState
from tango import AttrWriteType, DeviceProxy
# Additional import
# PROTECTED REGION ID(CspMaster.additionnal_import) ENABLED START #
# PROTECTED REGION ID(MidCspMaster.additional_import) ENABLED START #
#
from skabase.SKAMaster  import SKAMaster
from skabase.auxiliary import utils
# PROTECTED REGION END #    //  CspMaster.additionnal_import
file_path = os.path.dirname(os.path.abspath(__file__))
print(file_path)
# PROTECTED REGION ID (CspMaster.add_path) ENABLED START #
# add the path to import global_enum package.
# import CSP.LMC Common package
from csp_lmc_common.utils.cspcommons import HealthState, AdminMode
from csp_lmc_common.CspMaster import CspMaster
# PROTECTED REGION END# //CspMaster.add_path
# PROTECTED REGION END #    //  MidCspMaster.additionnal_import
__all__ = ["MidCspMasterBase", "main"]


@@ -427,7 +422,8 @@ class MidCspMasterBase(with_metaclass(DeviceMeta, CspMaster)):
        # PROTECTED REGION ID(CspMaster.availableReceptorIDs_read) ENABLED START #
        self._unassigned_receptor_id.clear()
        if not self._is_device_running(self.CspCbf, self._se_proxies):
            return self._unassigned_receptor_id
            return [0]
            #return self._unassigned_receptor_id[0]
        try:
            proxy = self._se_proxies[self.CspCbf]
            # get the State and sub-array affiliation of the VCC
@@ -484,7 +480,8 @@ class MidCspMasterBase(with_metaclass(DeviceMeta, CspMaster)):
                                         msg,
                                         "read_unassignedReceptorIDs",
                                         tango.ErrSeverity.ERR)
        
        if not len(self._unassigned_receptor_id):
            return [0]
        return self._unassigned_receptor_id
       
        # PROTECTED REGION END #    //  MidCspMasterBase.unassignedReceptorIDs_read