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(component_manager, adapter_factory=ska_tmc_common.AdapterFactory, logger=<Logger ska_tmc_subarraynode.commands.subarray_node_command (WARNING)>)

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]

task_callback_default(**kwargs)

Default method if the taskcallback is not passed

Parameters
  • status – status of the task.

  • progress – progress of the task.

  • result – result of the task.

  • exception – an exception raised from the task.

Return type

None

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_event_data_storage(device_name, unique_command_id)

This method populates the command_id in eventdatastorage. :type device_name: :param device_name: device name :type device_name: str :type unique_command_id: :param unique_command_id: command id :type unique_command_id: str

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 (dict) – JSON string including CSP resources.

Return type

Tuple[ResultCode, str]

Returns

A tuple containing ResultCode and message.

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/4.0',
'transaction_id': 'txn-....-00001', 'subarray_id': 1, 'mccs':
{'interface':
'https://schema.skao.int/ska-low-mccs-controller-allocate/3.0',
'subarray_beams': [{'subarray_beam_id': 1, 'apertures':
[{'station_id': 1, 'aperture_id': 'AP001.01'},
{'station_id': 1, 'aperture_id': 'AP001.02'}, {'station_id': 2,
'aperture_id': 'AP002.01'}, {'station_id': 2, 'aperture_id':
  'AP002.02'}
], 'number_of_channels': 8}]}, 'csp': {'pss': {'pss_beam_ids':
[1, 2, 3]}, 'pst': {'pst_beam_ids': [1]}}, 'sdp': {'interface': '
https://schema.skao.int/ska-sdp-assignres/0.4', 'resources': {'r
eceptors': ['C4', 'C57', 'C108', 'C165', 'C193', 'C200', 'S8-1',
  'S8-2', 'S9-1', 'S9-5', 'S10-1', 'S10-6', 'S16-3', 'S16-4',
  'S16-6'], 'receive_nodes': 1}, '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.7.1'}, 'sbi_ids': ['sbi-mvp01-20210623-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

get_csp_resources_low(input_json)

Create the input JSON for AssignResources on CSP Subarray Leaf Node device.

Return type

dict

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 for mid telescope and MCCS for low telescope 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 for mid telescope and MCCS Leaf Node for low telescope ).

check_only_dish_config(scan_configuration)

Method to check only dish configuration

Return type

Tuple[ResultCode, str]

configure_adapters(adapters, config)

Invoke configure command on adapters

Return type

Tuple[ResultCode, str]

configure_mapping_scan_dishes(pointing_groups, dish_scan_config_holography, adapter_map)

Method to configure Dishes based on receptor groups in JSON.

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.

{'interface': 'https://schema.skao.int/ska-low-tmc-configure/4.1',
'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':
'AP002.01', 'weighting_key_ref': 'aperture2'}],
'sky_coordinates': {'reference_frame': 'ICRS',
'c1': 180.0, 'c2': 45.0}}]}, 'sdp':
{'interface': 'https://schema.skao.int/ska-sdp-configure/0.4',
'scan_type': 'target:a'}, 'csp': {'interface':
'https://schema.skao.int/ska-low-csp-configure/3.2',
'common': {'config_id': 'sbi-mvp01-20200325-00001-science_A',
 'eb_id': 'eb-test-20220916-00000'}, '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}]}, 'timing_beams': {'fsp':
{'firmware': 'pst', 'fsp_ids': [2]}, 'beams':
[{'pst_beam_id': 1, 'field': {'target_name':
'PSR J0024-7204R', 'reference_frame': 'icrs',
'attrs': {'c1': 6.023625, 'c2': -72.08128333,
'pm_c1': 4.8, 'pm_c2': -3.3}}, 'stn_beam_id':
1, 'stn_weights': [0.9, 1.0, 1.0, 1.0, 0.9,
1.0]}]}}, 'pst': {'beams': [{'beam_id': 1,
'scan': {'activation_time':'2022-01-19T23:07:45Z',
'bits_per_sample': 32, 'num_of_polarizations': 2,
'udp_nsamp': 32, 'wt_nsamp': 32, 'udp_nchan': 24,
'num_frequency_channels': 432, 'centre_frequency':
200000000.0, 'total_bandwidth': 1562500.0,
'observation_mode': 'VOLTAGE_RECORDER',
'observer_id': 'jdoe', 'project_id': 'project1', 'pointing_id':
'pointing1', 'source': 'J1921+2153', 'itrf':
[5109360.133, 2006852.586, -3238948.127], 'receiver_id':
'receiver3', 'feed_polarization': 'LIN', 'feed_handedness': 1,
'feed_angle': 1.234, 'feed_tracking_mode': 'FA',
'feed_position_angle': 10.0, 'oversampling_ratio': [8, 7],
'coordinates': {'equinox': 2000.0, 'ra': '19:21:44.815',
'dec': '21:53:02.400'}, 'max_scan_length': 20000.0,
'subint_duration': 30.0, 'receptors': ['receptor1',
'receptor2'], 'receptor_weights': [0.4, 0.6],
'num_channelization_stages': 2, 'channelization_stages':
[{'num_filter_taps': 1, 'filter_coefficients':
[1.0], 'num_frequency_channels': 1024, 'oversampling_ratio':
[32, 27]}, {'num_filter_taps': 1, 'filter_coefficients':
[1.0], 'num_frequency_channels': 256, 'oversampling_ratio':
[4, 3]}]}}]}}, '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/4.1',
'transaction_id':'','pointing':{'target':{'reference_frame':'ICRS',
'target_name':'Polaris Australis','ra':'21:08:47.92',
'dec':'-88:57:22.9','ca_offset_arcsec':0.0,'ie_offset_arcsec':0.0},
'correction':'UPDATE'},'csp':{'interface':
'https://schema.skao.int/ska-csp-configurescan/4.1','common':
{'config_id':'sbi-mvp01-20200325-00001-science_A',
'frequency_band':'2','eb_id':'eb-m001-20230712-56789'},'pst':{},
'transaction_id':'txn-....-00001','midcbf':{'correlation':
{'processing_regions':[{'fsp_ids':[1],'start_freq':950000000,
'channel_width':13440,'channel_count':40,'sdp_start_channel_id':0,
'integration_factor':1}]}}},'sdp':{'interface':
'https://schema.skao.int/ska-sdp-configure/0.4','scan_type':
'target:a'},'tmc':{'scan_duration':10.0,'partial_configuration':
False}}
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)

get_and_verify_k_values()

Retrieves the k-values from dish leaf node adapters and verifies if they are all unique or the same.

Return type

Tuple[ResultCode, str]

Returns

A tuple containing a return code and a string message.

update_task_status(**kwargs)

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

Return type

None

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]

stop_dish_tracking()

Method to stop dish tracking

Return type

Tuple[ResultCode, str]

update_task_status(**kwargs)

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

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_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)

update_task_status(**kwargs)

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

Return type

None

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)

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]

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 while 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]

update_task_status(**kwargs)

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

Return type

None

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)

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)

send_scan_on_leaf_nodes(json_argument, **kwargs)

Send scan command on DLN, CSP, SDP :type json_argument: str :param json_argument: scan json argument :type json_argument: str

start_scan_timer(scan_duration)

Method for starting scan timer :type scan_duration: int :param scan_duration: scan duration in second :type scan_duration: int

Return type

None

submit_endscan_command()

Will submit the end scan

update_mccs_json(input_scan)

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

update_task_status(**kwargs)

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

Return type

None

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

set_admin_mode_command

Path: src/ska_tmc_subarraynode/commands/set_admin_mode_command.py

Class for setting the adminMode of lower level devices

class ska_tmc_subarraynode.commands.set_admin_mode_command.SetAdminMode(*args, **kwargs)

Bases: SubarrayNodeCommand

A class for SubarrayNode’s SetAdminMode command.

do_low(argin)

Method to invoke SetAdminMode command on the Subarray Leaf Nodes.

Parameters

argin (str, optional) – Input JSON for the command, containing the admin mode to be set.

Returns

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

Return type

(ResultCode, str)

invoke_setadminmode(argin, task_callback, task_abort_event=None)

This is a long-running method for the SetAdminMode command. It executes the do hook and invokes SetAdminMode on Subarray Leaf Nodes.

Parameters

logger (logging.Logger) – Logger instance.

Return type

None

set_admin_mode_csp(admin_mode)

SetAdminMode command on CSP Subarray Leaf Node.

Parameters

admin_mode (int) – The admin mode to be set.

Returns

A tuple containing the result code and a message.

Return type

(ResultCode, str)

set_admin_mode_mccs(admin_mode)

SetAdminMode command on MCCS Subarray Leaf Node.

Parameters

admin_mode (int) – The admin mode to be set.

Returns

A tuple containing the result code and a message.

Return type

(ResultCode, str)

set_admin_mode_sdp(admin_mode)

SetAdminMode command on SDP Subarray Leaf Node.

Parameters

admin_mode (int) – The admin mode to be set.

Returns

A tuple containing the result code and a message.

Return type

(ResultCode, str)

Module contents