def teardown_function(function): """ teardown any state that was previously setup with a setup_function call. """ the_waiter = waiter() if (resource('ska_mid/tm_subarray_node/1').get('obsState') == "IDLE"): the_waiter.set_wait_for_tearing_down_subarray() LOGGER.info("tearing down composed subarray (IDLE)") SubArray(1).deallocate() the_waiter.wait() LOGGER.info(the_waiter.logs) if (resource('ska_mid/tm_subarray_node/1').get('obsState') == "READY"): LOGGER.info("tearing down configured subarray (READY)") the_waiter.set_wait_for_ending_SB() SubArray(1).end_sb() the_waiter.wait() LOGGER.info(the_waiter.logs) the_waiter.set_wait_for_tearing_down_subarray() SubArray(1).deallocate() the_waiter.wait() LOGGER.info(the_waiter.logs) if (resource('ska_mid/tm_subarray_node/1').get('obsState') == "CONFIGURING"): LOGGER.info("tearing down configuring subarray") restart_subarray(1) if (resource('ska_mid/tm_subarray_node/1').get('obsState') == "SCANNING"): LOGGER.info("tearing down scanning subarray") restart_subarray(1) the_waiter.set_wait_for_going_to_standby() SKAMid().standby() LOGGER.info("standby command is executed on telescope") the_waiter.wait() LOGGER.info(the_waiter.logs)
def set_telescope_to_standby(): the_waiter = waiter() the_waiter.set_wait_for_going_to_standby() SKAMid().standby() the_waiter.wait() if the_waiter.timed_out: pytest.fail("timed out whilst setting telescope to standby:\n {}".format(the_waiter.logs))
def set_telescope_to_running(): the_waiter = waiter() the_waiter.set_wait_for_starting_up() SKAMid().start_up() the_waiter.wait() if the_waiter.timed_out: pytest.fail("timed out whilst starting up telescope:\n {}".format(the_waiter.logs))
def start_up(): the_waiter = waiter() the_waiter.set_wait_for_starting_up() SKAMid().start_up() the_waiter.wait() LOGGER.info("Telescope Started up") LOGGER.debug("the_waiter.logs")
def main(*args, **kwargs): """ Telescope standby. """ LOG.info(f'Running telescope standby script in OS process {os.getpid()}') if args: LOG.warning('Got unexpected positional args: %s', args) if kwargs: LOG.warning('Got unexpected named args: %s', kwargs) LOG.info(f'Executing telescope standby...') telescope = SKAMid() telescope.standby() LOG.info('Telescope standby script complete')
def main(*args, **kwargs): """ Start up telescope. """ LOG.info(f'Running telescope start-up script in OS process {os.getpid()}') if args: LOG.warning('Got unexpected positional args: %s', args) if kwargs: LOG.warning('Got unexpected named args: %s', kwargs) telescope = SKAMid() LOG.info(f'Starting telescope...') telescope.start_up() LOG.info('Telescope start-up script complete')
def set_to_running(result): SKAMid().start_up() #watch_State = watch(resource('ska_mid/tm_subarray_node/1')).for_a_change_on("State") watch_receptorIDList = watch(resource('ska_mid/tm_subarray_node/1')).for_a_change_on("receptorIDList") result['response'] = SubArray(1).allocate(ResourceAllocation(dishes=[Dish(1), Dish(2), Dish(3), Dish(4)])) logging.info("subarray state: " + resource('ska_mid/tm_subarray_node/1').get("State")) watch_receptorIDList.wait_until_value_changed() return result
def and_end_sb_when_ready(self): the_waiter = waiter() the_waiter.set_wait_for_going_to_standby() SKAMid().standby() the_waiter.wait() if the_waiter.timed_out: pytest.fail("timed out taking the subarray to IDLE:\n {}".format(the_waiter.logs)) self.logs = the_waiter.logs return self
def receptorID_list_empty(): watch_receptorIDList = watch(resource('ska_mid/tm_subarray_node/1')).for_a_change_on("receptorIDList") # gather info receptorIDList_val = watch_receptorIDList.get_value_when_changed() # confirm assert_that(receptorIDList_val == []) logging.info("ReceptorIDList is empty") # put telescope to standby SKAMid().standby()
def teardown_function(function): """ teardown any state that was previously setup with a setup_function call. """ if (resource('ska_mid/tm_subarray_node/1').get("State") == "ON"): the_waiter = waiter() the_waiter.set_wait_for_tearing_down_subarray() SubArray(1).deallocate() the_waiter.wait() LOGGER.info(the_waiter.logs) if (resource('ska_mid/tm_subarray_node/1').get("State") == "OFF"): the_waiter = waiter() the_waiter.set_wait_for_going_to_standby() SKAMid().standby() the_waiter.wait() LOGGER.info(the_waiter.logs)
def test_allocation(): the_telescope = SKAMid() the_subarray = SubArray(1) the_resource_allocation = ResourceAllocation(dishes=[Dish(1), Dish(2)]) print("Starting up telescope ...") the_telescope.start_up() #commented this out as it gives an error when it was already deallocated # print("Releasing any previously allocated resources... ") # result = the_subarray.deallocate() # pause() print("Allocating new resources... ") result = the_subarray.allocate(the_resource_allocation) pause( ) #rather poll for subarray_proxy.State changing OFF/OFLLINE to ON (TMC team to confirm whether this is really neccesary assert_that(result).is_equal_to(the_resource_allocation) # Confirm result via direct inspection of TMC subarray_proxy = DeviceProxy('ska_mid/tm_subarray_node/1') pause() # not neccesary receptor_list = subarray_proxy.receptorIDList pause() # not neccesary #need to check the state as well is in ObsState = IDLE and State = ON #TODO check the resource assignment of the CSP is correct (receptors and corresponding VCC state - also check that it changed to correct state) #mid_csp/elt/master check the status of receptors and VCC reflect assignment #mid_csp/elt/subarray_01 check status and correct composition # check the resource assignment of the SDP is correct (no op - also check that the changed to correct state ObsState= IDLE and State = ON) # check that the dishes have responded assert_that(receptor_list).is_equal_to((1, 2)) print("Now deallocating resources ... ") the_subarray.deallocate() pause( ) #rather poll for subarray_proxy.State changing ON OFFLINE (TMC team to confim) # Confirm result via direct inspection of TMC - expecting None receptor_list = subarray_proxy.receptorIDList pause() # not needed assert_that(receptor_list).is_equal_to(None) print("Subarry has no allocated resources") # put telescope to standby the_telescope.standby() print( "Script Complete: All resources dealoccated, Telescope is in standby")
def teardown_function(function): """ teardown any state that was previously setup with a setup_function call. """ the_waiter = waiter() if (resource('ska_mid/tm_subarray_node/1').get('obsState') == "IDLE"): #this means there must have been an error the_waiter.set_wait_for_tearing_down_subarray() LOGGER.info("tearing down composed subarray (IDLE)") SubArray(1).deallocate() the_waiter.wait() LOGGER.info(the_waiter.logs) if (resource('ska_mid/tm_subarray_node/1').get('obsState') == "READY"): #this means test must have passed LOGGER.info("tearing down configured subarray (READY)") the_waiter.set_wait_for_ending_SB() SubArray(1).end_sb() the_waiter.wait() LOGGER.debug(the_waiter.logs) the_waiter.set_wait_for_tearing_down_subarray() SubArray(1).deallocate() the_waiter.wait() LOGGER.debug(the_waiter.logs) if (resource('ska_mid/tm_subarray_node/1').get('obsState') == "CONFIGURING" ): LOGGER.warn( "Subarray is still in configuring! Please restart MVP manualy to complete tear down" ) restart_subarray(1) #raise exception since we are unable to continue with tear down raise Exception("Unable to tear down test setup") LOGGER.info("Putting Telescope in standby") the_waiter.set_wait_for_going_to_standby() SKAMid().standby() the_waiter.wait() LOGGER.debug(the_waiter.logs)
def start_up(): the_waiter = waiter() the_waiter.set_wait_for_starting_up() SKAMid().start_up() the_waiter.wait() LOGGER.info(the_waiter.logs)