ska_tmc_centralnode.commands package

See the TMC Commands Workflow section for details about TMC command workflows.

Submodules

ska_tmc_centralnode.commands.central_node_command module

Command class for central node

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

Bases: CentralNodeCommand

AssignResources command class

get_subarray_adapter(subarray_id)

Method for obtaining the adapter for a subarray.

Parameters:
  • subarray_id (int) – An integer representing the subarray ID (1-16 typically).

  • telescope_type (str) – The type of the telescope.

Returns:

(ResultCode, message)

Return type:

Tuple[ResultCode, str]

init_adapters_low()

Initialises adapter for central node low

Returns:

tuple of ResultCode and message.

Return type:

Tuple(ResultCode, str)

init_adapters_mid()

Initialises adapters for mid

Returns:

tuple of ResultCode and message.

Return type:

Tuple(ResultCode, str)

put_result_in_command_mapping_dict(return_codes, message_or_unique_ids)

Update command_mapping dictionary to add the ResultCode and unique_id for the command executed

set_command_id(command_name)

Sets the command id for error propagation.

Parameters:

command_name (str) – name of the command.

Return type:

None

class ska_tmc_centralnode.commands.central_node_command.CentralNodeCommand(component_manager, *args, logger=<Logger ska_tmc_centralnode.commands.central_node_command (WARNING)>, **kwargs)

Bases: TMCCommand

Central node command class

adapter_error_message(dev_name, error)

Adapter Error message

Parameters:
  • dev_name (str) – name of the device.

  • error – error message.

Return type:

Tuple[ResultCode, str]

Returns:

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

do(argin=None)

Do method for central node command class

Return type:

ResultCode

init_adapters()

Initialises adapters for central node command class

Return type:

Tuple[ResultCode, str]

invoke_command(adapters, err_msg, command_name, argin=None, callback=None)

Invokes command on adapters

Parameters:
  • adapters (List) – list of the adapters.

  • command_caller – command caller.

  • err_msg (str) – error message.

  • command_name (str) – Command name.

Returns:

tuple containing a list of return codes and a listof string msg. For Example: (ResultCode.OK, “”).

Return type:

Tuple(List, List)

invoke_command_and_add_tracking_data(adapter, command_name, command_input=None, callback=None)

Update command tracking data

invoke_command_lrc_cb(device_name)

Invoke LRC callback. Provide this callback whenever command is invoked using invoke_lrc api :type device_name: str :param device_name: Name Of Device

Returns:

function object to provided to invoke_lrc

Return type:

callback

invoke_commands_without_lrc(adapters, command_caller, err_msg, command_name)

Invokes command on adapters

Parameters:
  • adapters (List) – list of the adapters.

  • command_caller – command caller.

  • err_msg (str) – error message.

  • command_name (str) – Command name.

Returns:

tuple containing a list of return codes and a listof string msg. For Example: (ResultCode.OK, “”).

Return type:

Tuple(List, List)

reject_command(message)

Rejects command method for logs error message.

Parameters:

message (str) – Error message

Return type:

Tuple[TaskStatus, str]

Returns:

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

send_command(adapters, description, command, argin=None)

Submit command in progress

Parameters:
  • adapters (Optional[AdapterFactory]) – list of the adapters.

  • description (str) – message.

  • command (str) – Command name.

  • argin – Command input argument.

Returns:

Tuple of list of ResultCodes and messages

Return type:

Tuple(List, List)

wait_for_command_completion(device_length, desired_state=None, function_name=None, use_command_class_id=False)

This Method wait for desired obs state

class ska_tmc_centralnode.commands.central_node_command.LoadDishCfgCommand(component_manager, adapter_factory=None, *args, logger=None, **kwargs)

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

Initialises Adapters for mid

Return type:

Tuple[ResultCode, str]

class ska_tmc_centralnode.commands.central_node_command.SetDishGPM(component_manager, adapter_factory=None, *args, logger=None, **kwargs)

Bases: CentralNodeCommand

This command class for SetGlobalPointingModel command which forms GPM json CAR URI and pass it to TMC Dish Leaf Node.

init_adapters_mid()

Initialises Adapters for mid

Return type:

Tuple[ResultCode, str]

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

Bases: CentralNodeCommand

Central node abstract command class

init_adapters_low()

Initialises adapter low

Returns:

Tuple containing ResultCode and message

Return type:

Tuple(ResultCode, str)

init_adapters_mid()

Initialises adapters for mid

Returns:

Tuple containing ResultCode and message

Return type:

Tuple(ResultCode, str)

ska_tmc_centralnode.commands.central_node_command.task_callback_default(status=None, progress=None, result=None, exception=None)

Default method if the taskcallback is not passed

Parameters:
  • status (Optional[TaskStatus]) – status of the task.

  • progress (Optional[int]) – progress of the task.

  • result (Optional[Any]) – result of the task.

  • exception (Optional[Exception]) – an exception raised from the task.

Return type:

None

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.

assign_resources(argin, task_callback, task_abort_event)

This is a long running command method for AssignResources command.

It executes the do hook and invokes the AssignResources command on lower-level devices.

Parameters:

argin (str) – Input argument for the command.

Returns:

Result code and message.

Return type:

Tuple(ResultCode, str)

do_low(*args)

Temporary, will be removed after all command refactoring

do_mid(*args)

Temporary, will be removed after all command refactoring

get_subarray_obsstate()

This method returns obsstate of subarray.

Return type:

ObsState

update_task_status(result, exception='')

Updates the task status for a command.

Parameters:
  • result (Tuple[ResultCode, str]) – A tuple containing the result code and a message. The result code indicates whether the command succeeded or failed.

  • exception (str) – A string representing any exception message. This is used when the result indicates a failure. Default is an empty string.

Return type:

None

ska_tmc_centralnode.commands.release_resources_command module

ReleaseResources class for CentralNode.

class ska_tmc_centralnode.commands.release_resources_command.ReleaseResources(component_manager, adapter_factory=None, *args, logger=None, **kwargs)

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.

do_low(*args)

Temporary, will be removed after all command refactoring

do_mid(*args)

Temporary, will be removed after all command refactoring

get_subarray_obsstate()

This method returns obsstate of subarray.

Returns: ObsState

Return type:

ObsState

release_all_resources(adapter)

Releases all resources

Parameters:

adapter – Adapter

Returns:

Tuple of list of ResultCodes and lists of messages.

Return type:

Tuple(list, list)

release_resources(argin, task_callback, task_abort_event)

This is a long running command method for ReleaseResources command

Parameters:

argin (str) – Input argument for the command

Returns:

Result code and message

Return type:

Tuple[ResultCode, str]

update_task_status(result, exception='')

Updates the task status for command ReleaseResources

Parameters:
  • result (Tuple[ResultCode, str]) – A tuple containing the result code and a message. The result code indicates whether the command succeeded or failed.

  • exception (str) – A string representing any exception message. This is used when the result indicates a failure. Default is an empty string.

Return type:

None

ska_tmc_centralnode.commands.stow_antennas_command module

Command Class for Setting Stow command on Dishes

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

Bases: SetDishGPM

A class for CentralNode’s SetStowMode command. This command invokes SetStowMode command on specified dish id’s

add_data_to_stow_mode_dictionary_in_case_of_error(dish_id, error_message)

Update the SetStowMode data with aggregated error for given dish_id

Parameters:
  • dish_id (str) – Dish leaf node id.

  • error_message (str) – Error message.

Return type:

None

apply_stow_mode(argin, task_callback, task_abort_event)

Applies the STOW command to specified dish id’s in the list.

Parameters:
  • argin (list) – List of dishes on which Stow needs to apply.

  • logger (optional) – Logger instance.

  • task_callback (Callable, optional) – Callback to update task status.

  • task_abort_event (threading.Event, optional) – task abort event.

Return type:

Tuple[ResultCode, str]

Returns:

None

do(argin)

This command invokes the SetStowMode command on the dish_id’s specified in argin which is a list.

Parameters:

argin (list) – gpm_data ready for execution.

Returns:

Result code and message

Return type:

Tuple(ResultCode, str)

process_update_task_for_command_failure(error_message)

Method to update the task callback and GPM status with the failure data

Parameters:

task_callback – Update task state with the failure data

Return type:

str

set_stow_mode_cm_variables(dish_id, flag)

Set component manager variables for stow mode command.

Parameters:
  • dish_id (str) – Dish leaf node identifier

  • flag (bool) – True to increment execution counter

Return type:

None

update_stow_results(dev_name)

This method is used to update the result returned from Dish leaf nodes as part of SetGlobalPointingModel command. If all events are received from all device then aggregate the result Value contains (unique_id, ResultCode) :type dev_name: str :param dev_name: Name of the device who’s event has been :type dev_name: str :param captured in this method: :param value: longRunningCommandResult attribute event. :type value: tuple

Return type:

None

update_task_status(result, exception=None)

Updates the task status for command

Parameters:
  • result (Tuple[ResultCode, str]) – Result code of command

  • exception (str) – any message returned as a part of command

Return type:

None

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.

Parameters:

argin (Str) – Default is None.

Returns:

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

Return type:

Tuple(ResultCode, str)

do_mid(argin=None)

Method to invoke Off command on lower level devices.

Parameters:

argin (str) – Default is None.

Returns:

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

Return type:

Tuple(ResultCode, str)

telescope_off(logger, task_callback=None, task_abort_event=None)

This is a long running method

Parameters:
  • logger (Logger) – logger

  • task_callback (Optional[Callable]) – Update task state, defaults to None

  • task_abort_event (Optional[Event]) – Check for abort, defaults to None

  • task_abort_event – Event, optional

Return type:

Tuple[ResultCode, str]

turn_off_csp()

Turn off the CSP devices

Returns:

Tuple containing list of ResultCodes and list of messages

Return type:

Tuple(List, List)

turn_off_dishes()

Turn off the dishes

Returns:

tuple containing list of ReturnCodes and list of string message indicating status.

Return type:

Tuple(List, List)

turn_off_mccs()

Turn off the MCCS devices

Returns:

Tuple of list of Resultcodes and list of messages.

Return type:

Tuple(List, List)

turn_off_sdp()

Turn off the SDP devices

Returns:

Tuple containing list of ResultCodes and list of messages

Return type:

Tuple(List, List)

turn_off_subarrays()

Turn off the subarrays

Returns:

tuple containing list of ReturnCodes and list of string message indicating status.

Return type:

Tuple(List, List)

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.

Parameters:

argin (str) – Default to None in case of TelescopeOn.

Returns:

Tuple containing a return code and a string message indicating status.

Return type:

Tuple(ReSultCode, str)

do_mid(argin=None)

Method to invoke On command on Lower level devices.

Parameters:

argin (str) – Defaults to None in case of TelescopeOn.

Returns:

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

Return type:

Tuple(ResultCode, str)

set_standby_fp_mode_dishes()

Sets standby fb mode in dishes

Returns:

Tuple containing list of return codes and list of string message indicating status.

Return type:

Tuple(List, List)

telescope_on(logger, task_callback=None, task_abort_event=None)

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

Parameters:
  • logger (Logger) – logger

  • task_callback (Optional[Callable]) – Update task state, defaults to None

  • task_abort_event (Optional[Event]) – Check for abort, defaults to None

Return type:

Tuple[ResultCode, str]

turn_on_csp()

Turns on the csp

Returns:

A tuple containing list of return codes and list of string message indicating status.

Return type:

Tuple(List, List)

turn_on_mccs()

Turns on the MCCS

Returns:

Tuple containing list of ResultCodes and list of messages

Return type:

Tuple(List, List)

turn_on_sdp()

Turns on the SDP

Returns:

Tuple containing list of return codes and list of string message indicating status.

Return type:

Tuple(List, List)

turn_on_subarrays()

Turns on the subarrays

Returns:

Tuple containing list of return codes and list of string message indicating status.

Return type:

Tuple(List, List)

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.

Parameters:

argin (str) – Default None.

Returns:

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

Return type:

Tuple(ResultCode, str)

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.

Parameters:

argin (str) – Default is None in case of TelescopeStandby.

Returns:

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

Return type:

Tuple(List, List)

telescope_standby(logger, task_callback=None, task_abort_event=None)

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

Parameters:
  • logger (Logger) – logger

  • task_callback (Optional[Callable]) – Update task state, defaults to None

  • task_abort_event (Optional[Event]) – Check for abort, defaults to None

Return type:

None

turn_off_dishes()

Turns off the dishes

Returns:

tuple of list of ResultCodes and list of messages.

Return type:

Tuple(List, List)

turn_standby_csp()

Turns csp to standby

Returns:

tuple of list of ResultCodes and list of messages.

Return type:

Tuple(List, List)

turn_standby_mccs()

Turns MCCS into standby

Returns:

tuple of list of ResultCodes and list of messages.

Return type:

Tuple(List, List)

turn_standby_sdp()

Turns sdp to standby

Returns:

tuple of list of ResultCodes and list of messages.

Return type:

Tuple(List, List)

turn_standby_subarrays()

Turns subarrays to standby

Returns:

tuple of list of ResultCodes and list of messages.

Return type:

Tuple(List, List)

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

async_cb(device_name)

Invoke LRC callback. Provide this callback whenever command is invoked using invoke_lrc api :type device_name: str :param device_name: Name Of Device

Returns:

function object to provided to invoke_lrc

Return type:

callback

check_and_validate_dish_vcc_data(dishid_vcc_map_params)

This method downloads dish vcc json from telmodel and validates the data.

Parameters:

dishid_vcc_map_params (str) – JSON string containing parameters to fetch the dish VCC map.

Returns:

A tuple containing the dish VCC map JSON

and an error message string (empty if no error).

Return type:

Tuple[dict, str]

do(argin)

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.

Parameters:

dish_cfg_params (str) – Dish config parameters

Returns:

tuple of DishId-VCC map JSON and error message if any

Return type:

Tuple(dict, str)

get_dishid_vcc_map_json(initial_params)

Get DishId-VCC map json from initial params

Parameters:

initial_param (dict) – this param containg tm data source uri and file path which is used for extracting vcc_map json file

Returns:

tuple having DishId-VCC map json and Error message if any

Return type:

Tuple(dict, str)

load_dish_cfg(argin, task_callback, task_abort_event)

Load Dish Configuration command. Validates dish-vcc data, executes lower-level command.

Parameters:

argin (str) – Input argument for the command.

Returns:

Result code and message.

Return type:

Tuple(ResultCode, str)

load_dish_config_json_validator(argin)

Method to validate the JSON for LoadDishConfig Command

Parameters:

argin – Input argument for DishConfigValidator

Returns:

Tuple of boolean representing valid dish config and string representing message

Return type:

Tuple(bool, str)

set_command_id(command_name)

Sets the command id for error propagation.

Parameters:

command_name (str) – name of the command.

Return type:

None

update_memorized_attribute()

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

Return type:

None

update_task_status(result, exception='')

Updates the task status for command

Parameters:
  • result (Tuple[ResultCode, str]) – Result code of command

  • exception (str) – any message returned as a part of command

Return type:

None

ska_tmc_centralnode.commands.set_global_pointing_model module

Command Claas For Setting Global Pointing Model on Dishes

class ska_tmc_centralnode.commands.set_global_pointing_model.SetGlobalPointingModel(*args: Any, **kwargs: Any)

Bases: SetDishGPM

A class for CentralNode’s SetGlobalPointingModel command. This command forms GPM CAR URI and provide it to Dish Leaf Node

add_data_to_gpm_dictionary_in_case_of_error(dish_id, error_message)

Update the GPM data with aggregated error for given dish_id

Parameters:
  • dish_id (str) – Dish leaf node id.

  • error_message (str) – Error message.

apply_gpm(dish_gpm_params, logger, task_callback, task_abort_event)

Applies the Global Pointing Model (GPM) to dishes using the provided parameters. Parses the input JSON parameters, prepares GPM data per dish, and invokes the command to set the GPM on dish leaf nodes.

Parameters:
  • dish_gpm_params (str) – JSON string with GPM parameters.

  • logger (optional) – Logger instance.

  • task_callback (Callable, optional) – Callback to update task status.

  • task_abort_event (threading.Event, optional) – task abort event.

Return type:

None

Returns:

None

do(argin)

This command performs invokes the ApplyPointingModel command on the dish_id’s specified in argin which is a dictionary

Parameters:

argin (dict) – gpm_data ready for execution.

Returns:

Result code and message

Return type:

Tuple(ResultCode, str)

filter_failed_dish_data(data)

Filter Failed Dish Data :type data: dict :param data: Dish Data :type data: dict

Return type:

dict

Returns:

dish dict

form_gpm_file_for_each_dish(gpm_files, dish_gpm_params)

Method to form gpm data from gpm files found on GPM data repository.

Parameters:
  • gpm_files (list) – GPM files found on data repository.

  • dish_gpm_params (dict) – Default parameters set for GPM on initialization.

Return type:

dict

form_gpm_path_from_receptors(argin)

This method forms the inputs for ApplyPointingModel command

Parameters:
  • argin (dict) – Dictionary which contains manual command input

  • operator. (from) –

Return type:

dict

get_gpm_files(initial_params)

Get GPM files from initial params

Parameters:

initial_param (dict) – this param containg tm data source uri and file path which is used to get GPM files.

Returns:

containing GPM file names found on data repo.

Return type:

list

process_update_task_for_command_failure(error_message)

Method to update the task callback and GPM status with the failure data

Parameters:

task_callback – Update task state with the failure data

Return type:

None

update_set_gpm_results(dev_name, band_value)

This method is used to update the result returned from Dish leaf nodes as part of SetGlobalPointingModel command. If all events are received from all device then aggregate the result Value contains (unique_id, ResultCode) :type dev_name: str :param dev_name: Name of the device who’s event has been :type dev_name: str :param captured in this method: :param value: longRunningCommandResult attribute event. :type value: tuple

Return type:

None

update_task_status(result, exception='')

Updates the task status for command

Parameters:
  • result (Tuple[ResultCode, str]) – Result code of command

  • exception (str) – any message returned as a part of command

Return type:

None

Module contents