Commit dd859560 authored by Gianluca Marotta's avatar Gianluca Marotta
Browse files

Merge branch 'open-issues' into 'master'

Open issues

See merge request ska-telescope/csp-lmc!19
parents 5977b83f 0241f5d5
Loading
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
0.7.4
- OFF command when sub-element is ON-EMPTY
- Added transaction id to the common section of ADR-18/22 json config file.

0.7.3
- Solved dead-lock on Abort Command during Configuration
- Restart Command check the if subelements are EMPTY
+13 −7
Original line number Diff line number Diff line
@@ -573,7 +573,8 @@ class CspSubarray(SKASubarray):
            self.logger.info("Call Off Command")
            device = self.target
            subelement_thr = {}
            self.thread_succeeded = {}
            device_to_turn_off = []
            self.empty_succeeded = {}
            off_failed = False
            # First loop that start the sub-element threads to get the ObsState.EMPTY
            for fqdn in device._sc_subarray_fqdn:
@@ -581,20 +582,25 @@ class CspSubarray(SKASubarray):
                # requested state
                if device._sc_subarray_state[fqdn] == tango.DevState.OFF:
                    continue
                if device._sc_subarray_obs_state[fqdn] != ObsState.EMPTY:
                elif device._sc_subarray_obs_state[fqdn] != ObsState.EMPTY:
                    subelement_thr[fqdn] = threading.Thread(target=self.off_sequence,
                                                           name="Thread-OffSequence",
                                                           args=(fqdn,))
                    subelement_thr[fqdn].start()
                    device_to_turn_off.append(fqdn)
                else:
                    self.logger.info(f'ObsState of device {fqdn} is not EMPTY. ObsState:{device._sc_subarray_obs_state[fqdn]}')
                    self.logger.info(f'ObsState of device {fqdn} is already EMPTY. ObsState:{device._sc_subarray_obs_state[fqdn]}')
                    device_to_turn_off.append(fqdn)
                    self.empty_succeeded[fqdn] = True

            # Second loop check if the thread is succeeded and send the Off command to sub-element
            for fqdn in subelement_thr.keys():
                subelement_thr[fqdn].join()

            if any(self.thread_succeeded[fqdn] == True for fqdn in subelement_thr.keys()):
                for fqdn in subelement_thr.keys():
            if all(self.empty_succeeded[fqdn] for fqdn in device_to_turn_off):
                for fqdn in device_to_turn_off:
                    try:
                        self.logger.info('Sending Off Command...')
                        (result_code, message) = device._sc_subarray_proxies[fqdn].Off()
                    except tango.DevFailed as tango_err:
                        message = str(tango_err.args[0].desc)
@@ -644,9 +650,9 @@ class CspSubarray(SKASubarray):
                # if ObsState is: RESOURCING, ABORTING start again to wait end of the transition

            if device._sc_subarray_obs_state[fqdn] == ObsState.EMPTY:
                self.thread_succeeded[fqdn] = True
                self.empty_succeeded[fqdn] = True
            else:
                self.thread_succeeded[fqdn] = False
                self.empty_succeeded[fqdn] = False

    class AssignResourcesCommand(SKASubarray.AssignResourcesCommand):
        @transaction_id
+2 −0
Original line number Diff line number Diff line
@@ -66,6 +66,8 @@ class JsonConfiguration:
        """
        common_dict = self.get_section('common')
        cbf_dict = self.get_section('cbf')
        if 'transaction_id' in self.config:
            common_dict['transaction_id'] = self.get_section('transaction_id')
        config_converted = {**common_dict, **cbf_dict}
        validate_csp_config(version=0, config=config_converted) 
        self.config = config_converted
+1 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@
"""Release information for Python Package"""

name = """csp-lmc-common"""
version = "0.7.3"
version = "0.7.4"
version_info = version.split(".")
description = """SKA CSP.LMC Common Software"""
author = "INAF-OAA"
+10 −2
Original line number Diff line number Diff line
@@ -81,6 +81,8 @@ def test_cspsbarray_state_after_On_WITH_exception_raised_by_subelement_subarray(
    with fake_tango_system(device_under_test, initial_dut_properties=dut_properties, proxies_to_mock=proxies_to_mock) as tango_context:
        cbf_subarray_device_proxy_mock.On.side_effect = raise_devfailed_exception 
        pss_subarray_device_proxy_mock.On.side_effect = return_ok
        prober_state = Probe(tango_context.device, "State", DevState.OFF, f"State is not OFF")
        Poller(3, 0.1).check(prober_state)
        tango_context.device.On()
        assert tango_context.device.State() == DevState.FAULT
        assert tango_context.device.obsState == ObsState.EMPTY
@@ -108,6 +110,8 @@ def test_cspsbarray_state_after_On_WITH_command_failed_code_returned_by_subeleme
    with fake_tango_system(device_under_test, initial_dut_properties=dut_properties, proxies_to_mock=proxies_to_mock) as tango_context:
        cbf_subarray_device_proxy_mock.On.side_effect = return_failed
        pss_subarray_device_proxy_mock.On.side_effect = return_ok
        prober_state = Probe(tango_context.device, "State", DevState.OFF, f"State is not OFF")
        Poller(3, 0.1).check(prober_state)
        tango_context.device.On()
        assert tango_context.device.State() == DevState.FAULT
        assert tango_context.device.obsState == ObsState.EMPTY
@@ -134,6 +138,8 @@ def test_cspsbarray_state_after_On_WITH_command_failed_code_returned_by_pss_suba
    with fake_tango_system(device_under_test, initial_dut_properties=dut_properties, proxies_to_mock=proxies_to_mock) as tango_context:
        cbf_subarray_device_proxy_mock.On.side_effect = return_ok
        pss_subarray_device_proxy_mock.On.side_effect = return_failed
        prober_state = Probe(tango_context.device, "State", DevState.OFF, f"State is not OFF")
        Poller(3, 0.1).check(prober_state)
        tango_context.device.On()
        assert tango_context.device.State() == DevState.ON
        assert tango_context.device.obsState == ObsState.EMPTY
@@ -161,6 +167,8 @@ def test_cspsbarray_state_after_On_forwarded_to_subelement_subarray():
    with fake_tango_system(device_under_test, initial_dut_properties=dut_properties, proxies_to_mock=proxies_to_mock) as tango_context:
        cbf_subarray_device_proxy_mock.On.side_effect = return_ok
        pss_subarray_device_proxy_mock.On.side_effect = return_ok
        prober_state = Probe(tango_context.device, "State", DevState.OFF, f"State is not OFF")
        Poller(3, 0.1).check(prober_state)
        tango_context.device.On()
        assert tango_context.device.State() == DevState.ON
        assert tango_context.device.obsState == ObsState.EMPTY
@@ -192,8 +200,8 @@ def test_cspsubarray_transaction_id_in_log(capsys):
    with fake_tango_system(device_under_test, initial_dut_properties=dut_properties, proxies_to_mock=proxies_to_mock) as tango_context:
        cbf_subarray_device_proxy_mock.On.side_effect = return_ok
        pss_subarray_device_proxy_mock.On.side_effect = return_ok
        prober_obs_state = Probe(tango_context.device, "State", DevState.OFF, f"State is not OFF")
        Poller(3, 0.1).check(prober_obs_state)
        prober_state = Probe(tango_context.device, "State", DevState.OFF, f"State is not OFF")
        Poller(3, 0.1).check(prober_state)
        tango_context.device.On()
        assert tango_context.device.State() == DevState.ON
        #tango_context.device.AssignResources('{"subarrayID":1,"dish":{"receptorIDList":["0001","0002"]}}')
Loading