ska_tmc_subarraynode.commands package

Submodules

subarray_node_command

Path: src/ska_tmc_subarraynode/commands/subarray_node_command.py

SubarrayNode command class for SubarrayNode, a subclass of TMCCommand. This class provides methods to initialize adapters and executing commands on subarray devices.

class ska_tmc_subarraynode.commands.subarray_node_command.SubarrayNodeCommand(*args, **kwargs)

Bases: TMCCommand

This code defines the SubarrayNodeCommand class, which is a subclass of TMCCommand. This class provides methods for initializing adapters and executing commands on subarray devices.

adapter_error_message_result(dev_name, exception)

Returns ResultCode.FAILED with failure message as a tuple

Return type

Tuple[ResultCode, str]

clear_device_events()

Clears the device events dictionary

Return type

None

do(argin=None)
Return type

Tuple[ResultCode, str]

do_low(argin=None)
Return type

Tuple[ResultCode, str]

Abstract method from TMCCommand is

defined here but not utilized by this Class.

Args: argin (_type_, optional): Accepts argument if required.

Defaults to None.

do_mid(argin=None)
Return type

Tuple[ResultCode, str]

Abstract method from TMCCommand is

defined here but not utilized by this Class.

Args: argin (_type_, optional): Accepts argument if required.

Defaults to None.

get_adapter_by_device_name(device_name)
The get_adapter_by_device_name method takes a device_name as

input and searches for an adapter object in the adapter_factory object’s adapters attribute that matches the input device_name. If a matching adapter object is found, it is returned. If no matching adapter object is found, None is returned.

Args: device_name (str): The name of the device to search for.

Returns

An adapter object if a matching device is found, otherwise None.

get_dish_adapter_by_device_name(device_name_list)
The get_dish_adapter_by_device_name method takes a list of

device_name_list as input and searches for adapter objects in the adapter_factory object’s adapters attribute that match any of the device names in the input list. It returns a list of matching adapter objects.

Args: device_name_list (list): A list of device names to search for.

Returns

A list of adapter objects that match the device names in the input list. If no matching adapter object is found, an empty list is returned.

init_adapters()
Return type

Tuple[ResultCode, str]

init_adapters_low()
Return type

Tuple[ResultCode, str]

init_adapters_mid()
Return type

Tuple[ResultCode, str]

reject_command(message)

Method to return task status as TaskStatus.REJECTED along with the error message

Return type

Tuple[ResultCode, str]

update_command_in_progress_id(command_name)
Return type

None

The update_command_in_progress_id method updates

command_in_progress_id attributes of the component_manager object with the given command_name. It also logs information about the updated command.

Args: command_name (str): The name of the command being updated. Returns: None

update_task_status(**kwargs)

Abstract method from TMCCommand is defined here but not utilized by this Class.

assign_resources_command

Path: src/ska_tmc_subarraynode/commands/assign_resources_command.py

AssignResourcesCommand class for SubarrayNode.

class ska_tmc_subarraynode.commands.assign_resources_command.AssignResources(*args, **kwargs)

Bases: SubarrayNodeCommand

A class for SubarrayNode’s AssignResources() command.

Assigns resources to CSP, SDP via respective subarray leaf nodes. It also sets AssignedResources attribute on SubarrayNode.

assign_csp_resources(json_argument)

This function accepts the AssignResources input JSON and invokes the assign resources command on the CSP Subarray Leaf Node.

Parameters

json_argument (str) – AssignResources input JSON string without SDP block

Return type

Tuple[ResultCode, str]

Returns

A tuple containing a return code and a string message.

assign_low_csp_resources(argin)

This function accepts the CSP Resources as input and assigns CSP resources to CSP Subarray through CSP Subarray Leaf Node.

Parameters

argin (str) – JSON string including CSP resources.

Return type

Tuple[ResultCode, str]

Returns

A tuple containing ResultCode and string.

assign_sdp_resources(argin)

This function accepts SDP block from input AssignResources JSON and assigns SDP resources to SDP Subarray through SDP Subarray Leaf Node.

Parameters

argin (str) – List of strings JSON string containing only SDP resources.

Return type

Tuple[ResultCode, str]

Returns

A tuple containing a return code and a string message.

clear_resources()

Method for clearing resources in case of failure

do_low(argin)

Method to invoke AssignResources command on subarraynode low.

Parameters

argin (str) – DevString.

Example:

{"interface":
"https://schema.skao.int/ska-low-tmc-assignresources/3.1",
"transaction_id": "txn-....-00001","subarray_id": 1,"mccs":
{"subarray_beam_ids":[1],"station_ids": [[1,2]],"channel_blocks":
[3]},"sdp":{"interface":"https://schema.skao.int/ska-sdp-assignres/
0.4","resources":{"receptors": ["SKA001","SKA002","SKA003","SKA004"
]},"execution_block":{"eb_id": "eb-test-20220916-00000","context":
{},"max_length": 3600.0,"beams":[{"beam_id": "vis0","function":
"visibilities"}],"scan_types": [{"scan_type_id": ".default","beams"
:{"vis0": {"channels_id": "vis_channels","polarisations_id": "all"}
}},{"scan_type_id": "target:a","derive_from": ".default","beams": {
"vis0": {"field_id": "field_a"}}},{"scan_type_id":"calibration:b",
"derive_from": ".default","beams": {"vis0": {"field_id": "field_b"}
}}],"channels":[{"channels_id": "vis_channels","spectral_windows":
[{"spectral_window_id": "fsp_1_channels","count": 4,"start": 0,
"stride": 2,"freq_min": 350000000.0,"freq_max": 368000000.0,
"link_map":[[0,0],[200,1],[744,2],[944,3]]}]}],"polarisations":
[{"polarisations_id": "all","corr_type": ["XX","XY","YX","YY"]
}],fields": [{"field_id": "field_a","phase_dir":{"ra": [123.0],
"dec": [-60.0],"reference_time": "...","reference_frame": "ICRF3"},
"pointing_fqdn": "...",{"field_id": "field_b","phase_dir": {"ra":
[123.0],"dec": [-60.0],"reference_time": "...","reference_frame":
"ICRF3"},"pointing_fqdn": "..."}]},"processing_blocks":[{"pb_id":
"pb-test-20220916-00000","script": {"kind": "realtime","name":
"test-receive-addresses","version": "0.5.0"},"sbi_ids":
["sbi-test-20220916-00000"],"parameters": {}}]}}
Return type

Tuple[ResultCode, str]

Returns

A tuple containing ResultCode and string.

rtype:

(ResultCode, str)

Raises
  • ValueError if input argument json string contains invalid value

  • Exception if the command execution is not successful

do_mid(argin)

Method to invoke AssignResources command on subarraynode mid.

Parameters

argin (str) – DevString.

Example:

{"interface":
"https://schema.skao.int/ska-tmc-assignresources/2.1"
,"transaction_id":"txn-....-00001","subarray_id": 1,"dish":
{"receptor_ids":["SKA001"]},"sdp":{"interface":
"https://schema.skao.int/ska-sdp-assignres/0.4","execution_block":
{"eb_id":"eb-mvp01-20200325-00001","max_length": 100,"context":{},
"beams":[{"beam_id": "vis0","function":"visibilities"},{"beam_id":
"pss1","search_beam_id":1,"function": "pulsar search"},{"beam_id":
"pss2","search_beam_id": 2,"function":"pulsar search"},{"beam_id":
"pst1","timing_beam_id": 1,"function": "pulsar timing"},{"beam_id":
"pst2","timing_beam_id":2,"function": "pulsar timing"},{"beam_id":
"vlbi1","vlbi_beam_id":1,"function": "vlbi"}],"channels":
[{"channels_id":"vis_channels","spectral_windows":[{"spectral_
window_id":"fsp_1_channels","count": 744,"start": 0,"stride": 2,
"freq_min":350000000,"freq_max":368000000,"link_map": [[0,0],
[200,1],[744,2],[944,3]]},{"spectral_window_id":"fsp_2_channels",
"count": 744,"start": 2000,"stride": 1,"freq_min": 360000000,
"freq_max":368000000,"link_map": [[2000,4],[2200,5]]},{"spectral_
window_id":"zoom_window_1","count": 744,"start":4000,"stride": 1,
"freq_min":360000000,"freq_max": 361000000,"link_map": [[4000,6],
[4200,7]]}]},{"channels_id":"pulsar_channels","spectral_windows":
[{"spectral_window_id":"pulsar_fsp_channels","count": 744,"start":
0,"freq_min":350000000,"freq_max": 368000000}]}],"polarisations":
[{"polarisations_id": "all","corr_type":["XX","XY","YY","YX"]}],
"fields":[{"field_id": "field_a","phase_dir":{"ra":[123,0.1],"dec":
[123,0.1],"reference_time": "...","reference_frame": "ICRF3"},
"pointing_fqdn":"low-tmc/telstate/0/pointing"}]},"processing_blocks
":[{"pb_id": "pb-mvp01-20200325-00001","sbi_ids":["sbi-mvp01-
20200325-00001"],"script":{},"parameters":{},"dependencies":{}},
{"pb_id": "pb-mvp01-20200325-00002","sbi_ids":["sbi-mvp01-20200325-
00002"],"script":{},"parameters":{},"dependencies":{}},{"pb_id":
"pb-mvp01-20200325-00003","sbi_ids":["sbi-mvp01-20200325-00001",
"sbi-mvp01-20200325-00002"],"script":{},"parameters": {},
"dependencies":{}}],"resources":{"csp_links":[1,2,3,4],"receptors":
["FS4","FS8"],"receive_nodes":10}}}
Return type

Tuple[ResultCode, str]

Returns

A tuple containing a return code and a string message.

rtype:

(ResultCode, str)

Raises
  • KeyError if JSON parsing failed

  • Exception if the command execution is not successful

invoke_assign_resources(argin, task_callback, task_abort_event)

This is a long running method for AssignResources command, it executes do hook,invokes AssignResources command on CspSubarrayleafnode and SdpSubarrayleafnode.

Parameters
  • logger (logging.Logger) – logger

  • logger – argin

  • argin (str) – JSON string consisting of the resources to be assigned

  • task_abort_event (Event) – Check for abort events

Return type

None

set_up_dish_data(receptor_ids)

Creates dish leaf node and dish device FQDNs using input receptor ids. The healthState and pointingState attributes of all the dishes are subscribed.

Parameters

receptor_ids (str) – List of receptor IDs to be allocated to subarray. Example: [‘SKA001’, ‘SKA002’]

Return type

Tuple[ResultCode, str]

Returns

List of Resources added to the Subarray. Example: [‘SKA001’, ‘SKA002’]

update_task_status(**kwargs)

Method to update task status with result code and exception message if any.

Return type

None

validate_low_json(argin)

Method to validate low input jsons for AssignResources command

configure_command

Path: src/ska_tmc_subarraynode/commands/configure_command.py

Configure Command class for SubarrayNode.

class ska_tmc_subarraynode.commands.configure_command.Configure(*args, **kwargs)

Bases: SubarrayNodeCommand

A class for SubarrayNode’s Configure() command.

Configures the resources assigned to the Subarray. The configuration data for SDP, CSP and Dish is extracted out of the input configuration string and relayed to the respective underlying devices (SDP Subarray Leaf Node, CSP Subarray Leaf Node and Dish Leaf Node).

check_only_dish_config(scan_configuration)

Method to check only dish configuration

Return type

Tuple[ResultCode, str]

configure_low_csp(scan_config)

Method to configure low CSP

Return type

Tuple[ResultCode, str]

do_low(argin)

This method executes the Configure workflow of the Subarray Node Low. It will invoke Configure command on the CSP Subarray Leaf Node, SDP Subarray Leaf Node

Parameters

argin (str) – DevString.

JSON string example is:

{
"interface": "https://schema.skao.int/ska-low-tmc-configure/3.2",
"transaction_id": "txn-....-00001",
"mccs": {
    "subarray_beams": [
        {
            "subarray_beam_id": 1,
            "update_rate": 0.0,
            "logical_bands": [
                {"start_channel": 80, "number_of_channels": 16},
                {"start_channel": 384, "number_of_channels": 16}
            ],
            "apertures": [
                {
                    "aperture_id": "AP001.01",
                    "weighting_key_ref": "aperture2"
                },
                {
                    "aperture_id": "AP001.02",
                    "weighting_key_ref": "aperture3"
                },
                {
                    "aperture_id": "AP002.01",
                    "weighting_key_ref": "aperture2"
                },
                {
                    "aperture_id": "AP002.02",
                    "weighting_key_ref": "aperture3"
                },
                {
                    "aperture_id": "AP003.01",
                    "weighting_key_ref": "aperture1"
                }
            ],
            "sky_coordinates": {
                "reference_frame": "ICRS",
                "c1": 180.0,
                "c2": 45.0
            }
        }
    ]
},
"sdp": {
    "interface": "https://schema.skao.int/ska-sdp-configure/0.4",
    "scan_type": "science_A"
},
"csp": {
    "interface":"https://schema.skao.int/ska-low-csp-configure/3.1"
    "common": {
        "config_id": "sbi-mvp01-20200325-00001-science_A"
    },
    "lowcbf": {
        "stations": {
            "stns": [[1, 1],[2, 1],[3, 1],[4, 1],[5, 1],[6, 1]],
            "stn_beams": [{"beam_id": 1, "freq_ids": [400]}]
        },
        "vis": {
            "fsp": {"firmware": "vis", "fsp_ids": [1]},
            "stn_beams": [
                {
                    "stn_beam_id": 1,
                    "integration_ms": 849
                }
            ]
        }
    }
},
"tmc": {"scan_duration": 10.0}
}
Return type

Tuple[ResultCode, str]

Returns

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

rtype:

(ReturnCode, str)

do_mid(argin)

Method to invoke Configure command.

Parameters

argin (str) – DevString.

Return type

Tuple[ResultCode, str]

JSON string that includes pointing parameters of Dish - Azimuth and Elevation Angle, CSP Configuration and SDP Configuration parameters. JSON string example is:

{"interface":"https://schema.skao.int/ska-tmc-configure/2.1",
"transaction_id":"txn-....-00001","pointing":{"target":
{"reference_frame":"ICRS","target_name":"Polaris Australis",
"ra":"21:08:47.92","dec":"-88:57:22.9"}},"dish":
{"receiver_band":"1"},"csp":{"interface":
"https://schema.skao.int/ska-csp-configure/2.0","subarray":
{"subarray_name":"science period 23"},"common":{"config_id":
"sbi-mvp01-20200325-00001-science_A","frequency_band":"1",
"subarray_id":1},"cbf":{"fsp":[{"fsp_id":1,"function_mode":"CORR",
"frequency_slice_id":1,"integration_factor":1,"zoom_factor":0,
"channel_averaging_map":[[0,2],[744,0]],"channel_offset":0,
"output_link_map":[[0,0],[200,1]]},{"fsp_id":2,"function_mode":
"CORR","frequency_slice_id":2,"integration_factor":1,"zoom_factor"
:1,"channel_averaging_map":[[0,2],[744,0]],"channel_offset":744,
"output_link_map":[[0,4],[200,5]],"zoom_window_tuning":650000}],
"vlbi":{}},"pss":{},"pst":{}},"sdp":{"interface":
"https://schema.skao.int/ska-sdp-configure/0.4","scan_type":
"science_A"},"tmc":{"scan_duration":10.0}}
Note: While invoking this command from JIVE, provide

above JSON string without any space.

return: A tuple containing a return code and a string message

indicating status.The message is for information purpose only.

rtype: (ReturnCode, str)

invoke_configure(argin, task_callback, task_abort_event)

This is a long running method for Configure command, it executes do hook, invokes Configure command on CspSubarrayleafnode, SdpSubarrayleafnode and Dishleafnode.

Parameters
  • argin (Json string) – JSON string consisting of the resources to be configured

  • task_abort_event (Event) – Check for abort events

Return type

None

update_task_status(**kwargs)

Method to update task status with result code and exception message if any.

Return type

None

class ska_tmc_subarraynode.commands.configure_command.ElementDeviceData

Bases: object

A class representing data for an element device.

static build_up_csp_cmd_data(scan_config, delay_model_subscription, receive_addresses_map, component_manager)

Here the input data for CSP is build which is used in configuration of CSP. Below is the csp_config_schema variable value generated by using ska_telmodel library.

{
"interface": "https://schema.skao.int/ska-low-csp-configure/3.1",
"common": {
    "config_id": "sbi-mvp01-20200325-00001-science_A"
},
"lowcbf": {
    "stations": {
        "stns": [[1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1]],
        "stn_beams": [{"beam_id": 1, "freq_ids": [400]}]
    },
    "vis": {
        "fsp": {"firmware": "vis", "fsp_ids": [1]},
        "stn_beams": [
            {
                "stn_beam_id": 1,
                "integration_ms": 849
            }
        ]
    }
}
}
Return type

Tuple[ResultCode, str]

Returns

csp confiuration schema

static build_up_dsh_cmd_data(scan_config, component_manager)

Method to build up dish command data

Return type

Tuple[ResultCode, str]

static build_up_sdp_cmd_data(scan_config, component_manager)

Method to build up sdp command data

Return type

Tuple[ResultCode, str]

end_command

Path: src/ska_tmc_subarraynode/commands/end_command.py

A class for TMC SubarrayNode’s End() command

class ska_tmc_subarraynode.commands.end_command.End(*args, **kwargs)

Bases: SubarrayNodeCommand

A class for SubarrayNode’s End() command.

This command on Subarray Node invokes End command on CSP Subarray Leaf Node and SDP Subarray Leaf Node, and stops tracking of all the assigned dishes.

do_low(argin=None)

Method to invoke End command on MCCS Subarray Leaf Node.

Return type

Tuple[ResultCode, str]

Returns

A tuple containing a return code and a string message indicating execution status of command.

rtype:

(ResultCode, str)

do_mid(argin=None)

Method to invoke End command on CSP Subarray Leaf Node, SDP Subarray Leaf Node and Dish Leaf Nodes.

Return type

Tuple[ResultCode, str]

Returns

A tuple containing a return code and a string message indicating execution status of command.

rtype:

(ResultCode, str)

end_csp()

End command on CSP Subarray Leaf Node

Return type

Tuple[ResultCode, str]

end_mccs()

End command on Mccs Subarray Leaf Node.

Return type

Tuple[ResultCode, str]

end_sdp()

End command on SDP Subarray Leaf Node

Return type

Tuple[ResultCode, str]

invoke_end(logger, task_callback, task_abort_event=None)

This is a long running method for End command, it executes do hook, invokes End Command SdpSubarrayleafnode.

Parameters
  • logger (logging.Logger) – logger

  • task_abort_event (Event, optional) – Check for abort, defaults to None

Return type

None

stop_dish_tracking()

Method to stop dish tracking

Return type

Tuple[ResultCode, str]

update_task_status()

Method to update task status with result code and exception message if any.

This method is intended for updating the task status and is currently a placeholder. It should be implemented in the future to handle task status updates when necessary.

Note: Currently not implemented. Future enhancements might involve updating task status based on specific conditions or events during command execution.

Return type

None

end_scan_command

Path: src/ska_tmc_subarraynode/commands/end_scan_command.py

A class for TMC SubarrayNode’s EndScan() command.

class ska_tmc_subarraynode.commands.end_scan_command.EndScan(*args, **kwargs)

Bases: SubarrayNodeCommand

A class for SubarrayNode’s EndScan() command.

Ends the scan. It is invoked on subarray after completion of the scan duration. It can also be invoked by an external client while a scan is in progress, Which stops the scan immediately irrespective of the provided scan duration.

do_low(argin=None)

This method executes the End Scan workflow of the Subarray Node Low. It will invoke End Scan command on the CSP Subarray Leaf Node, SDP Subarray Leaf Node.

return: None

raises: DevFailed if the command execution is not successful.

Return type

Tuple[ResultCode, str]

do_mid(argin=None)

Method to invoke Endscan command.

return: None

raises: The command execution is not successful.

Return type

Tuple[ResultCode, str]

end_scan()

Method for setting device for Subarray Mid

Return type

None

end_scan_low()

Setting up device for low csp, sdp and mccs

Return type

Tuple[ResultCode, str]

end_scan_mccs()

Ends the scanning process on the Mccs Subarray Leaf Node.

This method sends the EndScan command to the Mccs Subarray Leaf Node, indicating the completion of the scanning process.

Returns

A tuple containing a return code and a string message indicating the status. The message is for information purposes only

Return type

Tuple[ResultCode, str]

end_scan_mid()

Method to invoke EndScan command on TMC-mid subsystems

Return type

Tuple[ResultCode, str]

Returns

(ResultCode, message)

endscan_csp()

Method to invoke EndScan command on CSP Subarray Leaf Node.

Return type

Tuple[ResultCode, str]

Returns

(ResultCode, message)

endscan_dishes()

Method to invoke EndScan command on Dish Leaf Nodes.

Return type

Tuple[ResultCode, str]

Returns

(ResultCode, message)

endscan_sdp()

Method to invoke EndScan command on SDP Subarray Leaf Node.

Return type

Tuple[ResultCode, str]

Returns

(ResultCode, message)

invoke_end_scan(logger, task_callback, task_abort_event=None)

This is a long running method for Scan command, it executes do hook, invokes EndScan command on CspSubarrayleafnode and SdpSubarrayleafnode.

Parameters
  • logger (logging.Logger) – logger

  • task_abort_event (Event, optional) – Check for abort, defaults to None

update_task_status()

Method to update task status with result code and exception message if any.

This method is intended for updating the task status and is currently a placeholder. It should be implemented in the future to handle task status updates when necessary.

Return type

None

Note: Currently not implemented. Future enhancements might involve

updating task status based on specific conditions or events during command execution.

release_all_resources_command

Path: src/ska_tmc_subarraynode/commands/release_all_resources_command.py

ReleaseAllResources Command for SubarrayNode

class ska_tmc_subarraynode.commands.release_all_resources_command.ReleaseAllResources(*args, **kwargs)

Bases: SubarrayNodeCommand

A class for TMC SubarrayNode’s ReleaseAllResources() command.

It checks whether all resources are already released. If yes then it returns code FAILED. If not it Releases all the resources from the subarray i.e. Releases resources from TMC Subarray Node, CSP Subarray and SDP Subarray. Upon successful execution, all the resources of a given subarray get released and empty array is returned. Selective release is not yet supported.

clean_up_low_resources()

Clears the assignedResources attribute.

Cleans dictionaries of the resources across the subarraynode.

Note: Currently there are only receptors allocated so only the receptor ids details are stored.

Parameters

argin – None

Return type

Tuple[ResultCode, str]

Returns

None

clean_up_mid_resources()

Clears the AssignedResources attribute.

Cleans dictionaries of the resources across the subarraynode.

Note: Currently there are only receptors allocated so only the receptor ids details are stored.

Parameters

argin – None

Return type

Tuple[ResultCode, str]

Returns

None

do_low(argin=None)

Method to invoke ReleaseAllResources command.

Return type

Tuple[ResultCode, str]

Returns

A tuple containing a return code STARTED on successful release all resources and message.

rtype:

(ResultCode, str)

do_mid(argin=None)

Method to invoke ReleaseAllResources command.

Returns

A tuple containing a return code and “” as a string on successful release all resources.

rtype:

(ResultCode, str)

invoke_release_resources(logger, task_callback, task_abort_event)

This is a long running method for ReleaseAllResources command, it executes do hook,invokes ReleaseAllResources command on CspSubarrayleafnode and SdpSubarrayleafnode.

Parameters
  • logger (logging.Logger) – logger

  • task_abort_event (Event) – Check for abort events

release_csp_resources()

This function invokes releaseAllResources command on CSP Subarray via CSP Subarray Leaf Node.

Parameters

argin – DevVoid

Return type

Tuple[ResultCode, str]

Returns

DevVoid

release_sdp_resources()

This function invokes releaseAllResources command on SDP Subarray via SDP Subarray Leaf Node.

Parameters

argin – DevVoid

Return type

Tuple[ResultCode, str]

Returns

DevVoid

update_task_status(**kwargs)

Method to update task status with result code and exception message if any.

Return type

None

restart_command

Path: src/ska_tmc_subarraynode/commands/restart_command.py

Restart Command for SubarrayNode.

class ska_tmc_subarraynode.commands.restart_command.Restart(*args, **kwargs)

Bases: SubarrayNodeCommand

A class representing the Restart command for SubarrayNode.

This command restarts various leaf nodes of the Subarray, including CSP Subarray Leaf Node, SDP Subarray Leaf Node, and Mccs Subarray Leaf Node to reset ongoing activities and configurations.

Parameters
  • component_manager – The component manager instance.

  • obs_state_model – The observational state model of the Subarray.

  • adapter_factory – An optional adapter factory instance.

  • logger – An optional logger instance for logging. Default is None.

clean_up_configuration()

Cleans up the configuration and resources of the Subarray.

Returns

A tuple containing the result code and an empty string.

Return type

Tuple[ResultCode, str]

clean_up_dishes()

Removes the dish devices from input parameter class. Also unsubscribes events for dish and dish leaf node attributes.

Returns

A tuple containing the result code and an empty string.

Return type

Tuple[ResultCode, str]

do_low(argin=None)

Invokes the Restart command on CSP Subarray Leaf Node, SDP Subarray Leaf Node, and Mccs Subarray Leaf Node to restarts the respective devices.

Parameters

argin (str, optional) – Optional argument. Default is None.

Returns

A tuple containing the result code and a message indicating the execution status.

Return type

Tuple[ResultCode, str]

do_mid(argin=None)

Invokes the Restart command on CSP Subarray Leaf Node, SDP Subarray Leaf Node, and Dish Leaf Nodes.

Parameters

argin (str, optional) – Optional argument. Default is None.

Returns

A tuple containing the result code and a message indicating the execution status.

Return type

Tuple[ResultCode, str]

invoke_restart(logger, task_callback, task_abort_event=None)

Invokes the Restart command on various leaf nodes of the Subarray.

Parameters
  • logger (logging.Logger) – The logger instance for logging.

  • task_callback (TaskCallbackType, optional) – An optional callback function for task status updates. Default is None.

  • task_abort_event (threading.Event, optional) – An optional threading event for checking task abort status. Default is None.

Return type

None

restart_csp()

Restarts the CSP devices by invoking the Restart command on the CSP Subarray Leaf Node.

Returns

A tuple containing the result code and an empty string.

Return type

Tuple[ResultCode, str]

restart_dishes()

Restarts all Dish Leaf Nodes in the Subarray.

Returns

A tuple containing the result code and an empty string.

Return type

Tuple[ResultCode, str]

restart_mccs()

Restarts the MCCS devices by invoking the Restart command on the MccsSubarrayLeafNode.

Return type

Tuple[ResultCode, str]

Returns

A tuple containing the result code and an empty string.

  • ResultCode.OK: If the Restart command is executed successfully.

  • ResultCode.FAILED: If there is an error in invoking the Restart

    command.

Raises
  • Exception – If the execution of the Restart command fails on the

  • MccsSubarrayLeafNode.

restart_sdp()

Restarts the SDP devices by invoking the Restart command on the SDP Subarray Leaf Node.

Returns

A tuple containing the result code and an empty string.

Return type

Tuple[ResultCode, str]

scan_command

Path: src/ska_tmc_subarraynode/commands/scan_command.py

A class for TMC SubarrayNode’s Scan() command

class ska_tmc_subarraynode.commands.scan_command.Scan(*args, **kwargs)

Bases: SubarrayNodeCommand

A class for SubarrayNode’s Scan() command. The command accepts Scan id as an input and executes a scan on the subarray. Scan command is invoked on respective CSP and SDP subarray node for the provided interval of time. It checks whether the scan is already in progress. If yes it throws error showing duplication of command.

do_low(argin)

Method to invoke Scan command.

Parameters

argin (str) – DevString. JSON string containing id.

Return type

Tuple[ResultCode, str]

JSON string example as follows: .. code-block:

{"interface": "https://schema.skao.int/ska-low-tmc-scan/4.0",
"transaction_id": "txn-....-00001", "subarray_id": 1,
"scan_id": 1 }
Note: Above JSON string can be used as an input argument while

invoking this command from JIVE.

return: A tuple containing a return code and a string message

indicating execution status of command.

rtype: Tuple(ReturnCode, str)

raises: DevFailed if the command execution is not successful

do_mid(argin)

Method to invoke Scan command.

Parameters

argin (str) – DevString. JSON string containing id.

Return type

Tuple[ResultCode, str]

JSON string example as follows: .. code-block:

{interface": "https://schema.skao.intg/ska-tmc-scan/2.0",
"transaction_id": "txn-....-00001",
"scan_id": 1}
Note: Above JSON string can be used as an input

argument while invoking this command from WEBJIVE.

return: A tuple containing a return code and a string message

indicating status.The message is for information purpose only.

rtype: Tuple(ReturnCode, str)

invoke_scan(argin, task_callback, task_abort_event=None)

This is a long running method for Scan command, it executes do hook,invokes Scan command on CspSubarrayleafnode and SdpSubarrayleafnode.

Parameters
  • argin (Json string, defaults to None) – JSON string consisting of the resources to be Scan

  • task_abort_event (Event, optional) – Check for abort, defaults to None

Return type

None

scan_csp(argin)

Method to invoke Scan command on CSP Subarray Leaf Node.

Return type

Tuple[ResultCode, str]

Returns

(ResultCode, message)

scan_csp_low(argin)

Method to invoke Scan command on CSP Subarray Leaf Node Low.

Return type

Tuple[ResultCode, str]

Returns

(ResultCode, message)

scan_dishes(dish_scan_config)

Method to invoke Scan command on Dish Leaf Nodes.

Return type

Tuple[ResultCode, str]

Returns

(ResultCode, message)

scan_mccs(argin)

Initiates a scanning process on the MCCS Subarray Leaf Node with the specified configuration.

This method sends the Scan command to the MCCS Subarray Leaf Node, initiating the scanning process with the provided configuration.

Parameters

argin (dict) – A dictionary containing configuration parameters for the scanning process. The format and content of this dictionary should comply with the requirements of the MCCS Subarray Leaf Node.

Returns

A tuple containing a return code and a string message indicating the status. The message is for information purposes only

Return type

Tuple[ResultCode, str]

scan_sdp(argin)

Method to invoke Scan command on SDP Subarray Leaf Node.

Return type

Tuple[ResultCode, str]

Returns

(ResultCode, message)

start_scan_timer(scan_duration)

Method for starting scan timer

Return type

None

update_mccs_json(input_scan)

This Scan command input string is updated to send to MCCS Subarray Leaf Node.

update_task_status()

Method to update task status with result code and exception message if any. This method is intended for updating the task status and is currently a placeholder. It should be implemented in the future to handle task status updates when necessary.

Return type

None

Note: Currently not implemented. Future enhancements might involve

updating task status based on specific conditions or events during command execution.

off_command

Path: src/ska_tmc_subarraynode/commands/off_command.py

Off Command for SubarrayNode

class ska_tmc_subarraynode.commands.off_command.Off(*args, **kwargs)

Bases: SubarrayNodeCommand

A class for Subarraynode’s Off() command.

do_low(argin=None)

Method to invoke off command on the MCCS Subarray Leaf Node.

Parameters

argin – Input json for Command, defaults to None

Type

None

Return type

Tuple[ResultCode, str]

return: A tuple containing a return code and a

string message indicating execution status of command.

rtype: (ResultCode, str)

do_mid(argin=None)

Method to invoke Off command on SDP Subarray Leaf Nodes.

Parameters

argin (Optional[str]) – Input json for Command, defaults to None

Type

None

Return type

Tuple[ResultCode, str]

return: A tuple containing a return code and a

string message indicating execution status of command.

rtype: (ResultCode, str)

get_csp_subarray_obstate()

Return obstate of csp subarray obstate

get_sdp_subarray_obstate()

Return obstate of sdp subarray obstate

get_subarray_obstate(dev_name)

Return obstate of subarray obstate

subarray_off(logger, task_callback, task_abort_event=None)

“This is a long running method for Off command, it executes do hook, invokes Off command on SdpSubarrayleafnode.

Parameters
  • logger (logging.Logger) – logger

  • task_callback (TaskCallbackType, optional) – Update task state, defaults to None

  • task_abort_event (Event, optional) – Check for abort, defaults to None

update_task_status()

Method for implementing for updating task status

on_command

Path: src/ska_tmc_subarraynode/commands/on_command.py

On Command for SubarrayNode

class ska_tmc_subarraynode.commands.on_command.On(*args, **kwargs)

Bases: SubarrayNodeCommand

A class for the SubarrayNode’s On() command.

do_low(argin=None)

Method to invoke On command on MccsSubarrayLeafNode, Low CspSubarrayLeafNode and Low SdpSubarrayLeafNode.

Parameters

argin – Input json for Command, defaults to None

Type

None

Returns

A tuple containing a return code and a string message indicating execution status of command.

Return type

Tuple(ResultCode, str)

Raises

Exception if the command execution is not successful

do_mid(argin=None)

Method to invoke On command on Mid CspSubarrayLeafNode and SdpSubarrayLeafNode.

Parameters

argin (Optional[str]) – Input json for Command, defaults to None

Type

None

Returns

A tuple containing a return code and a string message indicating execution status of command.

Return type

Tuple(ResultCode, str)

Raises

DevFailed if the command execution is not successful

on_leaf_nodes(logger, task_callback, task_abort_event=None)

This is a long running method for On command, it executes do hook, invokes On command on CspSubarrayleafnode and SdpSubarrayleafnode.

Parameters
  • logger (logging.Logger) – logger

  • task_callback (TaskCallbackType, optional) – Update task state, defaults to None

  • task_abort_event (Event, optional) – Check for abort, defaults to None

Module contents