ska_tmc_centralnode.commands package

Submodules

ska_tmc_centralnode.commands.abstract_command module

Abstract Command class for central node

class ska_tmc_centralnode.commands.central_node_command.AssignReleaseResources(*args: Any, **kwargs: Any)

Bases: CentralNodeCommand

AssignResources command class

init_adapters_low() Tuple[ska_tango_base.commands.ResultCode, str]

Initialises adapter for central node low

init_adapters_mid() Tuple[ska_tango_base.commands.ResultCode, str]

Initialises adapter for mid

class ska_tmc_centralnode.commands.central_node_command.CentralNodeCommand(*args: Any, **kwargs: Any)

Bases: TMCCommand

Central node abstract command class

adapter_error_message(dev_name: str, error) Tuple[ska_tango_base.commands.ResultCode, str]

Adapter Error message

do(argin: Optional[str] = None) ska_tango_base.commands.ResultCode

Do method for central node command class

init_adapters() Tuple[ska_tango_base.commands.ResultCode, str]

Initialises adapters for central node command class

invoke_command(adapters: list, command_caller, err_msg: str, command_name: str) Tuple[ska_tango_base.commands.ResultCode, str]

Invokes command on adapter

reject_command(message: str) Tuple[ska_tango_base.commands.ResultCode, str]

Rejects command method for logs error message.

send_command(adapters: Optional[ska_tmc_common.adapters.AdapterFactory], description: str, command: str, argin=None)

Submit command in progress

class ska_tmc_centralnode.commands.central_node_command.LoadDishCfgCommand(*args: Any, **kwargs: Any)

Bases: CentralNodeCommand

This command class for LoadDishConfig command which load dishid-vcc map json from CAR and pass it to CSP Master

init_adapters_mid() Tuple[ska_tango_base.commands.ResultCode, str]

Initialises Adapters for mid

class ska_tmc_centralnode.commands.central_node_command.SetadMinMode(*args: Any, **kwargs: Any)

Bases: CentralNodeCommand

SetAdminMode command class

init_adapters_low() Tuple[ska_tango_base.commands.ResultCode, str]

Initializes adapters for Central Node Low

class ska_tmc_centralnode.commands.central_node_command.TelescopeOnOff(*args: Any, **kwargs: Any)

Bases: CentralNodeCommand

Central node abstract command class

init_adapters_low() Tuple[ska_tango_base.commands.ResultCode, str]

Initialises adapter low

init_adapters_mid() Tuple[ska_tango_base.commands.ResultCode, str]

Initialises adapters for mid

ska_tmc_centralnode.commands.central_node_command.task_callback_default(status: Optional[ska_tango_base.executor.TaskStatus] = None, progress: Optional[int] = None, result: Optional[Any] = None, exception: Optional[Exception] = None) None

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.

ska_tmc_centralnode.commands.set_admin_mode_command module

Class for setting the adminMode of lower level devices

class ska_tmc_centralnode.commands.set_admin_mode_command.SetAdminMode(*args: Any, **kwargs: Any)

Bases: SetadMinMode

A class for CentralNode’s SetAdminMode command.

do_low(argin: str, task_callback: Optional[ska_tango_base.base.TaskCallbackType] = None) Tuple[ska_tango_base.commands.ResultCode, str]

Processes the SetAdminMode command for low-level devices.

do_mid()

Not implemented for now.

init_adapters_mid()

Not implemented for now..

invoke_setadminmode(argin: str, task_callback: ska_tango_base.base.TaskCallbackType, task_abort_event: Optional[Event] = None) None

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

set_admin_mode_generic(device_type: str, adapter: Optional[Union[ska_tmc_common.AdapterFactory, list]], admin_mode: str) Tuple[ska_tango_base.commands.ResultCode, str]

Generic method to set admin mode for devices.

Parameters:
  • device_type – Type of the device (sdp, csp, mccs, tmc_subarray).

  • adapter – Adapter instance for the device.

  • admin_mode – Admin mode value to be set.

Returns:

Result code and message.

update_task_status()

Updates task status.

ska_tmc_centralnode.commands.assign_resources_command module

AssignResources Command class for CentralNode.

class ska_tmc_centralnode.commands.assign_resources_command.AssignResources(*args: Any, **kwargs: Any)

Bases: AssignReleaseResources

A class for CentralNode’s AssignResources() command.

Assigns resources to a given subarray. It accepts the subarray ID, receptor ID list, and SDP block in JSON string format.

Upon successful execution, the ‘receptor_ids’ attribute of the given subarray is populated with the given receptors.

Checking for duplicate allocation of resources is done. If already allocated, it will throw an error message regarding the prior existence of the resource.

create_mccs_cmd_data(json_argument: dict) dict

Method to prepare the input json_argument required while invoking AssignResources() command on MCCS Master Leaf Node.

Param:

json_argument

Type:

The string in JSON format.

Returns:

The string in JSON format.

do_low(argin: str) Tuple[ska_tango_base.commands.ResultCode, str]

Method to invoke AssignResources command on Subarray.

Parameters:

argin – 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’: {‘receptors’:[‘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’:{}}]}}

Returns:

A tuple containing a return code and a string msg. For Example: (ResultCode.OK, “”)

Raises:

KeyError if input argument json string contains invalid key

ValueError if input argument json string contains invalid value

AssertionError if Mccs On command is not completed.

do_mid(argin: str) Tuple[ska_tango_base.commands.ResultCode, str]

Method to invoke the AssignResources command on a Subarray.

Parameters:

argin (str) – Input argument for the command

{“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-20210623-00000”, “max_length”: 100.0,”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”}],”scan_types”: [{“scan_type_id”: “.default”, “beams”: {“vis0”: {“channels_id”: “vis_channels”, “polarisations_id”: “all”},”pss1”: {“field_id”: “pss_field_0”, “channels_id”: “pulsar_channels”,”polarisations_id”: “all” }, “pss2”: {“field_id”: “pss_field_1”,”channels_id”: “pulsar_channels”, “polarisations_id”: “all”},”pst1”: {“field_id”: “pst_field_0”, “channels_id”: “pulsar_channels”,”polarisations_id”: “all”}, “pst2”: {“field_id”: “pst_field_1”,”channels_id”: “pulsar_channels”, “polarisations_id”: “all”},”vlbi”: {“field_id”: “vlbi_field”, “channels_id”: “vlbi_channels”,”polarisations_id”: “all”}}}, { “scan_type_id”: “target:a”,”derive_from”: “.default”,”beams”: { “vis0”: {“field_id”: “field_a”}}}],”channels”: [{ “channels_id”: “vis_channels”,”spectral_windows”: [{ “spectral_window_id”: “fsp_1_channels”,”count”: 744,”start”: 0, “stride”: 2,”freq_min”: 350000000.0,”freq_max”: 368000000.0, “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.0,”freq_max”: 368000000.0, “link_map”: [ [2000, 4],[2200, 5]]}, { “spectral_window_id”: “zoom_window_1”,”count”: 744,”start”: 4000, “stride”: 1,”freq_min”: 360000000.0,”freq_max”: 361000000.0, “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.0,”freq_max”: 368000000.0 }]}],”polarisations”: [{“polarisations_id”: “all”, “corr_type”: [“XX”, “XY”, “YY”, “YX”]}], “fields”: [{“field_id”: “field_a”,”phase_dir”: {“ra”: [123, 0.1], “dec”: [80, 0.1],”reference_time”: “…”,”reference_frame”: “ICRF3”}, “pointing_fqdn”: “low-tmc/telstate/0/pointing”}]}, “processing_blocks”: [{“pb_id”: “pb-mvp01-20210623-00000”, “sbi_ids”: [“sbi-mvp01-20200325-00001”],”script”: {“kind”: “realtime”, “name”: “vis_receive”,”version”: “0.1.0”},”parameters”: {}}, { “pb_id”: “pb-mvp01-20210623-00001”, “sbi_ids”: [“sbi-mvp01-20200325-00001”], “script”: {“kind”: “realtime”,”name”: “test_realtime”, “version”: “0.1.0”},”parameters”: {}}, { “pb_id”: “pb-mvp01-20210623-00002”, “sbi_ids”: [“sbi-mvp01-20200325-00002”],”script”: {“kind”: “batch”, “name”: “ical”,”version”: “0.1.0”},”parameters”: {},”dependencies”: [{ “pb_id”: “pb-mvp01-20210623-00000”,”kind”: [“visibilities”]}]}, { “pb_id”: “pb-mvp01-20210623-00003”, “sbi_ids”: [“sbi-mvp01-20200325-00001”, “sbi-mvp01-20200325-00002”], “script”: {“kind”: “batch”,”name”: “dpreb”,”version”: “0.1.0” }, “parameters”: {},”dependencies”: [{“pb_id”: “pb-mvp01-20210623-00002”, “kind”: [“calibration”]}]}], “resources”: {“csp_links”: [1, 2, 3, 4], “receptors”: [“FS4”, “FS8”, “FS16”, “FS17”, “FS22”, “FS23”, “FS30”, “FS31”, “FS32”, “FS33”, “FS36”, “FS52”, “FS56”, “FS57”, “FS59”, “FS62”, “FS66”, “FS69”, “FS70”, “FS72”, “FS73”, “FS78”, “FS80”, “FS88”, “FS89”, “FS90”, “FS91”, “FS98”, “FS108”, “FS111”, “FS132”, “FS144”, “FS146”, “FS158”, “FS165”, “FS167”, “FS176”, “FS183”, “FS193”, “FS200”, “FS345”, “FS346”, “FS347”, “FS348”, “FS349”, “FS350”, “FS351”, “FS352”, “FS353”, “FS354”, “FS355”, “FS356”, “FS429”, “FS430”, “FS431”, “FS432”, “FS433”, “FS434”, “FS465”, “FS466”, “FS467”, “FS468”, “FS469”, “FS470”], “receive_nodes”: 10 } }}

Returns:

Result code and message

Return type:

Tuple[ResultCode, str]

get_subarray_adapter(subarray_id: int) Tuple[ska_tango_base.commands.ResultCode, str]

Method for obtaining the adapter for a subarray.

Param:

subarray_id

Type:

An integer representing the subarray ID.

Returns:

A tuple containing a ResultCode enum value and a string message.

update_resource_config_file(json_argument: dict, sdp_id: str) None

Updates the resource configuration file.

This method updates the resource configuration file with unique identifiers for execution blocks and processing blocks. It fetches unique IDs using the skuid service and updates the corresponding entries in the provided JSON argument.

Parameters:

json_argumentdict

A dictionary containing the JSON argument for the update. This dictionary should have a specific structure with keys for ‘sdp’, ‘execution_block’, and ‘processing_blocks’.

sdp_idstr

A string representing the ID for the resource configuration file.

Returns:

None

Raises:

Exception

If the ‘processing_blocks’ key is not present in the input JSON argument.

update_task_status(result: Tuple[ska_tango_base.commands.ResultCode, str], exception: str = '') None

Updates the task status for a command.

Parameters:

resultTuple[ResultCode, str]

A tuple containing the result code and a message. The result code indicates whether the command succeeded or failed.

exceptionstr, optional

A string representing any exception message. This is used when the result indicates a failure. Default is an empty string.

Returns:

None

ska_tmc_centralnode.commands.release_resources_command module

ReleaseResources class for CentralNode.

class ska_tmc_centralnode.commands.release_resources_command.ReleaseResources(*args: Any, **kwargs: Any)

Bases: AssignReleaseResources

A class for CentralNode’s ReleaseResources() command.

Release all the resources assigned to the given Subarray. It accepts the subarray id, releaseALL flag and receptorIDList in JSON string format. When the releaseALL flag is True, ReleaseAllResources command is invoked on the respective SubarrayNode. In this case,the receptorIDList tag is empty as all the resources of the Subarray are to be released. When releaseALL is False, ReleaseResources will be invoked on the SubarrayNode and the resources provided in receptorIDList tag, are to be released from the Subarray. The selective release of the resources when releaseALL Flag is False is not yet supported.

create_mccs_input_data(json_argument: dict) dict

Creates mccs input strings

do_low(argin)

Method to invoke ReleaseResources command on Subarray Node.

Param:

argin

Type:

DevString

Example:

{"interface":
"https://schema.skao.int/ska-low-tmc-releaseresources/2.0",
"transaction_id":"txn-....-00001","subarray_id":1,
"release_all":true}
Returns:

A tuple containing a return code and a string msg. For Example: (ResultCode.OK, “”)

Raises:

ValueError if input argument json string contains invalid value

KeyError if input argument json string contains invalid key

DevFailed if the command execution or command invocation on

SubarrayNode is not successful

do_mid(argin: str) Tuple[ska_tango_base.commands.ResultCode, str]

Method to invoke ReleaseResources command on Subarray.

Parameters:

argin – DevString

Example:

{"interface":
"https://schema.skao.int/ska-tmc-releaseresources/2.0",
"transaction_id": "txn-....-00001",
"subarray_id": 1,
"release_all": true,
"receptor_ids": []
}

:return: A tuple containing a return code and a string msg.
    For Example:
    (ResultCode.OK, "")
release_all_resources(adapter)

Releases all resources

release_all_resources_mccs(adapter, argin)

Releases all resources mccs

update_task_status(result: Tuple[ska_tango_base.commands.ResultCode, str], exception: str = '')

Updates the task status for command ReleaseResources

ska_tmc_centralnode.commands.stow_antennas_command module

Command class for StowAntennas()

class ska_tmc_centralnode.commands.stow_antennas_command.StowAntennas(*args: Any, **kwargs: Any)

Bases: CentralNodeCommand

A class for CentralNode’s StowAntennas() command.

Invokes the command SetStowMode on the specified receptors.

check_allowed()

Checks whether this command is allowed It checks that the device is in a state to perform this command and that all the component needed for the operation are not faulty

Returns:

True if this command is allowed

Return type:

boolean

do(argin: List[str]) Tuple[ska_tango_base.commands.ResultCode, str]

Method to invoke StowAntennas command.

param argin:

List of Receptors to be stowed.

init_adapters()

Initialises adapters for central node command class

set_stow_mode_dishes(adapters)

Method for set stow mode for dish

ska_tmc_centralnode.commands.telescope_off_command module

Command class for TelescopeOff()

class ska_tmc_centralnode.commands.telescope_off_command.TelescopeOff(*args: Any, **kwargs: Any)

Bases: TelescopeOnOff

A class for CentralNode’s TelescopeOff() command. Sets the

CentralNode into telescopeState to OFF.

do_low(argin=None)

Method to invoke Off command on lower level devices. param: None

Returns:

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

rtype:

(ResultCode, str)

do_mid(argin=None)

Method to invoke Off command on lower level devices. param: None

Returns:

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

rtype:

(ResultCode, str)

telescope_off(logger, task_callback: Optional[Callable] = None, task_abort_event: Optional[Event] = None)

This is a long running method

Parameters:
  • logger (logging.Logger) – logger

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

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

turn_off_csp()

Turn off the CSP devices

turn_off_dishes()

Turn off the dishes

turn_off_mccs()

Turn off the MCCS devices

turn_off_sdp()

Turn off the SDP devices

turn_off_subarrays()

Turn off the subarrays

update_task_status()

Updates task status implemented to

ska_tmc_centralnode.commands.telescope_on_command module

Command class for TelescopeOn()

class ska_tmc_centralnode.commands.telescope_on_command.TelescopeOn(*args: Any, **kwargs: Any)

Bases: TelescopeOnOff

A class for CentralNode’s TelescopeOn() command.

TelescopeOn command on Central node enables the telescope to perform further operations and observations. It Invokes On command on lower level devices.

do_low(argin=None)

Method to invoke On command on Lower level devices.

param argin:

None.

do_mid(argin=None)

Method to invoke On command on Lower level devices.

param argin:

None.

set_standby_fp_mode_dishes() Tuple[List[ska_tango_base.commands.ResultCode], List[str]]

Sets standby fb mode in dishes

telescope_on(logger, task_callback: Optional[Callable] = None, task_abort_event: Optional[Event] = None)

This is a long running method for TelescopeOn command, it executes do hook, invokes TelescopeOn command on lowe level devices.

Parameters:
  • logger (logging.Logger) – logger

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

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

turn_on_csp()

Turns on the csp

turn_on_mccs()

Turns on the MCCS

turn_on_sdp()

Turns on the SDP

turn_on_subarrays() None

Turns on the subarrays

update_task_status()

Updates task status implemented to

ska_tmc_centralnode.commands.telescope_standby_command module

Command class for TelescopeStandby command

class ska_tmc_centralnode.commands.telescope_standby_command.TelescopeStandby(*args: Any, **kwargs: Any)

Bases: TelescopeOnOff

A class for CentralNode’s TelescopeStandby() command.

do_low(argin=None)

Method to invoke Standby command on SubarrayNode and MCCS Master Leaf Node.

param:

None

Returns:

A tuple containing a return code and a message

do_mid(argin=None)

Method to invoke TelescopeStandby command on SubarrayNode, CSP and SDP Master Leaf Nodes. Also to invoke StandbyFP and then StandbyLP commands on Dish Leaf Nodes.

param:

None

Returns:

A tuple containing a return code and a message

telescope_standby(logger, task_callback: Optional[Callable] = None, task_abort_event: Optional[Event] = None)

This is a long running method for TelescopeStandby command, it executes do hook, invokes TelescopeStandby command on lower level devices.

Parameters:
  • logger (logging.Logger) – logger

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

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

turn_off_dishes()

Turns off the dishes

turn_standby_csp()

Turns csp to standby

turn_standby_mccs()

Turns MCCS into standby

turn_standby_sdp()

Turns sdp to standby

turn_standby_subarrays()

Turns subarrays to standby

update_task_status()

blank method for resolving pylint errors

ska_tmc_centralnode.commands.load_dish_config_command module

Commad class for Load_dish_config_command

class ska_tmc_centralnode.commands.load_dish_config_command.LoadDishCfg(*args: Any, **kwargs: Any)

Bases: LoadDishCfgCommand

A class for CentralNode’s LoadDishConfig command. Load DishId-VCC map from CAR URI and provide it to Csp Master Leaf Node After Validation

do(argin: str) Tuple[ska_tango_base.commands.ResultCode, str]

This command performs the following steps: 1. Loads the content of the DishId-VCC mapping file from CAR URI. 2. Validates the JSON. 3. Invokes a command on the CSP master leaf node. 4. Invokes the SetKValue command on the Dish Leaf Node for each dish ID provided in the DishId-VCC map.

Parameters:

argin (str) – DishId-VCC map parameters in JSON string format.

Returns:

Result code and message

Return type:

Tuple[ResultCode, str]

fetch_dishid_vcc_map(dish_cfg_params)

Fetch the DishId-VCC map JSON.

get_dishid_vcc_map_json(initial_params: dict) Tuple[dict, str]

Get DishId-VCC map json from initial params :param initial_param: this param containg tm data source uri and file path which is used for extracting vcc_map json file

load_dish_cfg(dish_cfg_params: str, logger=None, task_callback: Optional[Callable] = None, task_abort_event: Optional[Event] = None) None
Parameters:
  • logger (logging.Logger) – logger

  • dish_cfg_params – dishid vcc map params

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

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

load_dish_config_json_validator(argin)

Method to validate the JSON for LoadDishConfig Command

update_memorized_attribute() None

Update memorized attribute so after restart this attribute used to get dish map vcc version set before restart

update_task_status(result: Tuple[ska_tango_base.commands.ResultCode, str], exception: str = '')

Updates the task status for command :param result: Result code of command :type: ResultCode enum :param message: any message returned as a part of command :type message: str

Module contents