def __init__(self):
     self.the_watch = watch(
         resource("ska_mid/tm_subarray_node/1")).for_a_change_on("obsState")
     self.the_watch1 = watch(
         resource("mid_sdp/elt/subarray_1")).for_a_change_on("obsState")
     resource("ska_mid/tm_subarray_node/1").assert_attribute(
         "obsState").equals("ABORTED")
 def __init__(self):
     self.w = watch(
         resource("ska_mid/tm_subarray_node/1")).for_a_change_on("obsState")
     self.w1 = watch(
         resource("mid_csp/elt/subarray_01")).for_a_change_on("obsState")
     self.w2 = watch(
         resource("mid_sdp/elt/subarray_1")).for_a_change_on("obsState")
Exemple #3
0
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
Exemple #4
0
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()
Exemple #5
0
def config():
    timeout = 60
    devices_to_log = [
        'ska_mid/tm_subarray_node/1', 'mid_csp/elt/subarray_01',
        'mid_csp_cbf/sub_elt/subarray_01', 'mid_sdp/elt/subarray_1',
        'mid_d0001/elt/master', 'mid_d0002/elt/master', 'mid_d0003/elt/master',
        'mid_d0004/elt/master'
    ]
    non_default_states_to_check = {
        'mid_d0001/elt/master': 'pointingState',
        'mid_d0002/elt/master': 'pointingState',
        'mid_d0003/elt/master': 'pointingState',
        'mid_d0004/elt/master': 'pointingState'
    }
    # update the ID of the config data so that there is no duplicate configs send during tests
    file = 'resources/test_data/polaris_b1_no_cam.json'
    update_file(file)
    signal.signal(signal.SIGALRM, handlde_timeout)
    signal.alarm(timeout)  # wait for 20 seconds and timeout if still stick
    #set up logging of components
    s = StateChecker(devices_to_log,
                     specific_states=non_default_states_to_check)
    s.run(threaded=True, resolution=0.1)
    LOGGER.info("Starting Configuration Test")
    d = DeviceLogging('DeviceLoggingImplWithDBDirect')
    d.update_traces(devices_to_log)
    d.start_tracing()
    #setup a watch for subarray node to change obstate as transaction should only  be complete once it has changed
    w = watch(
        resource('ska_mid/tm_subarray_node/1')).for_a_change_on("obsState")
    try:
        SubArray(1).configure_from_file(file, with_processing=False)
    except:
        LOGGER.info(
            "Configure Command timed out after {} seconds".format(timeout))
        LOGGER.info("Gathering logs")
        # sleep for 0.2 seconds to gather any pending events
        sleep(0.2)
        d.stop_tracing()
        s.stop()
        print_logs_to_file(s, d, status='error')
        LOGGER.info(
            "The following messages was logged from devices:\n{}".format(
                d.get_printable_messages()))
        #LOGGER.info("The following states was captured:\n{}".format(s.get_records()))
        pytest.fail("timed out during confguration")
    #ensure state is on Ready before proceeding
    w.wait_until_value_changed_to('READY', timeout=20)
    LOGGER.info("Configure executed successfully")
    LOGGER.info("Gathering logs")
    s.stop()
    d.stop_tracing()
    print_logs_to_file(s, d, status='ok')
 def __init__(self):
     self.the_watch = watch(
         resource("ska_mid/tm_subarray_node/1")).for_a_change_on("obsState")
Exemple #7
0
def _change_dish_mode(dev_proxy, cmd, device_name):
    dev_proxy.command_inout(cmd)
    watch_dish_mode = watch(resource(device_name)).for_a_change_on("dishMode")
    assert isinstance(watch_dish_mode, monitor)
    watch_dish_mode.wait_until_value_changed()
Exemple #8
0
def invoke_scan_command(fixture):
    executor = futures.ThreadPoolExecutor(max_workers=1)
    fixture['watch_subarray_state'] = watch(resource('ska_mid/tm_subarray_node/1')).for_a_change_on("obsState")
    future = executor.submit(send_scan, fixture['duration'])
    fixture['future'] = future
    return fixture
 def __init__(self):
     self.w = watch(
         resource('ska_mid/tm_subarray_node/1')).for_a_change_on("obsState")
Exemple #10
0
def _change_dish_mode(dev_proxy, cmd, device_name):
    getattr(dev_proxy, cmd)()
    watch_dish_mode = watch(resource(device_name)).for_a_change_on('dishMode')
    watch_dish_mode.wait_until_value_changed()
Exemple #11
0
def check_dish_mode():
    LOGGER.info(f"Waiting for {DISH} dishMode to report STOW")
    watch_dish_mode = watch(resource(DISH)).for_a_change_on("dishMode")
    watch_dish_mode.wait_until_value_changed_to("STOW")
    assert_that(resource(DISH).get("dishMode")).is_equal_to("STOW")
    LOGGER.info(f"{DISH} current dishMode: {resource(DISH).get('dishMode')}")