ska_tmc_sdpsubarrayleafnode.manager package

Submodules

ska_tmc_sdpsubarrayleafnode.manager.component_manager module

This module provided a reference implementation of a BaseComponentManager.

It is provided for explanatory purposes, and to support testing of this package.

class ska_tmc_sdpsubarrayleafnode.manager.component_manager.SdpSLNComponentManager(*args: Any, **kwargs: Any)

Bases: TmcLeafNodeComponentManager

A component manager for The SDP Subarray Leaf Node component.

It supports:

  • Monitoring its component, e.g. detect that it has been turned off or on

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

Invokes Abort command on Sdp Subarray and changes the obsstate

Parameters:

task_callback – callback to be called whenever the status of the task changes.

assign_resources(argin: str, task_callback: ska_tango_base.base.TaskCallbackType) Tuple[ska_tango_base.executor.TaskStatus, str]

Submit the AssignResources command in queue.

Returns:

a result code and message

cmd_ended_cb(event)

Callback function immediately executed when the asynchronous invoked command returns. Checks whether the command has been successfully invoked on SdpSubarray.

Parameters:

event – a CmdDoneEvent object. This object is used to passdata to the callback method in asynchronous callback model forcommand execution.

configure(argin: str, task_callback: ska_tango_base.base.TaskCallbackType) Tuple[ska_tango_base.executor.TaskStatus, str]

Submits the Configure command for execution.

Return type:

tuple

end(task_callback: ska_tango_base.base.TaskCallbackType) Tuple[ska_tango_base.executor.TaskStatus, str]

Submits the End command for execution.

Return type:

tuple

end_scan(task_callback: ska_tango_base.base.TaskCallbackType) Tuple[ska_tango_base.executor.TaskStatus, str]

Submits the EndScan command for execution.

Return type:

tuple

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

This method is used for generating command result

get_device() ska_tmc_common.device_info.SubArrayDeviceInfo

Return the device info our of the monitoring loop with name dev_name

Parameters:

None

Returns:

a device info

Return type:

DeviceInfo

get_obs_state() ska_tango_base.control_model.ObsState

Get Current device obsState

is_command_allowed(command_name: str) Union[bool, ska_tmc_common.exceptions.InvalidObsStateError, ska_tmc_common.exceptions.DeviceUnresponsive, ska_tmc_common.exceptions.CommandNotAllowed]

Checks whether this command is allowed It checks that the device is in the right state to execute this command and that all the component needed for the operation are not unresponsive

Returns:

True if this command is allowed

Return type:

boolean

property lrc_result: Tuple[str, str]

Returns the longRunningCommandResult attribute.

Returns:

the longRunningCommandResult

Return type:

spectrum

off(task_callback: ska_tango_base.base.TaskCallbackType) Tuple[ska_tango_base.executor.TaskStatus, str]

Submits the Off command for execution.

Return type:

tuple

on(task_callback: ska_tango_base.base.TaskCallbackType) Tuple[ska_tango_base.executor.TaskStatus, str]

Submits the On command for execution.

Return type:

tuple

raise_invalid_obsstate_error(command_name: str) ska_tmc_common.exceptions.InvalidObsStateError

checking the InvalidObsState of SdpSubarray device :param command_name: The name of command :type command_name: str

release_all_resources(task_callback: ska_tango_base.base.TaskCallbackType) Tuple[ska_tango_base.executor.TaskStatus, str]

Submits the ReleaseAllResources command for execution.

Return type:

tuple

restart(task_callback: Optional[ska_tango_base.base.TaskCallbackType] = None) Tuple[ska_tango_base.executor.TaskStatus, str]

Submit the Restart command in queue.

Returns:

a result code and message

scan(argin: str, task_callback: ska_tango_base.base.TaskCallbackType) Tuple[ska_tango_base.executor.TaskStatus, str]

Submits the Scan command for execution.

Return type:

tuple

standby(task_callback: Optional[Callable] = None) None

Standby command is not implemented by SDP Subarray Leaf Node device.

start_communicating() None

Establish communication with the component, then start monitoring.

This is the place to do things like:

  • Initiate a connection to the component (if your communication is connection-oriented)

  • Subscribe to component events (if using “pull” model)

  • Start a polling loop to monitor the component (if using a “push” model)

stop()

Method used to Stop the liveliness probe and event receiver for given devices.

stop_communicating() None

Cease monitoring the component, and break off all communication with it.

For example,

  • If you are communicating over a connection, disconnect.

  • If you have subscribed to events, unsubscribe.

  • If you are running a polling loop, stop it.

update_command_result(command_name: str, value: str) None

Updates the long running command result callback

update_device_obs_state(obs_state: ska_tango_base.control_model.ObsState) None

Update a monitored device obs state, and call the relative callbacks if available

Parameters:

obs_state (ObsState) – obs state of the device

update_device_ping_failure(device_info: ska_tmc_common.device_info.SubArrayDeviceInfo, exception: str) None

Set a device to failed and call the relative callback if available

Parameters:
  • device_info (DeviceInfo) – a device info

  • exception – an exception

Type:

Exception

update_event_failure() None

Update event failures

update_ping_info(ping: int, device_name: str) None

Update a device with the correct ping information.

Parameters:
  • device_name (str) – name of the device

  • ping (int) – device response time

Module contents

Init module for SDP Subarray Leaf Node Manager

class ska_tmc_sdpsubarrayleafnode.manager.SdpSLNComponentManager(*args: Any, **kwargs: Any)

Bases: TmcLeafNodeComponentManager

A component manager for The SDP Subarray Leaf Node component.

It supports:

  • Monitoring its component, e.g. detect that it has been turned off or on

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

Invokes Abort command on Sdp Subarray and changes the obsstate

Parameters:

task_callback – callback to be called whenever the status of the task changes.

assign_resources(argin: str, task_callback: ska_tango_base.base.TaskCallbackType) Tuple[ska_tango_base.executor.TaskStatus, str]

Submit the AssignResources command in queue.

Returns:

a result code and message

cmd_ended_cb(event)

Callback function immediately executed when the asynchronous invoked command returns. Checks whether the command has been successfully invoked on SdpSubarray.

Parameters:

event – a CmdDoneEvent object. This object is used to passdata to the callback method in asynchronous callback model forcommand execution.

configure(argin: str, task_callback: ska_tango_base.base.TaskCallbackType) Tuple[ska_tango_base.executor.TaskStatus, str]

Submits the Configure command for execution.

Return type:

tuple

end(task_callback: ska_tango_base.base.TaskCallbackType) Tuple[ska_tango_base.executor.TaskStatus, str]

Submits the End command for execution.

Return type:

tuple

end_scan(task_callback: ska_tango_base.base.TaskCallbackType) Tuple[ska_tango_base.executor.TaskStatus, str]

Submits the EndScan command for execution.

Return type:

tuple

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

This method is used for generating command result

get_device() ska_tmc_common.device_info.SubArrayDeviceInfo

Return the device info our of the monitoring loop with name dev_name

Parameters:

None

Returns:

a device info

Return type:

DeviceInfo

get_obs_state() ska_tango_base.control_model.ObsState

Get Current device obsState

is_command_allowed(command_name: str) Union[bool, ska_tmc_common.exceptions.InvalidObsStateError, ska_tmc_common.exceptions.DeviceUnresponsive, ska_tmc_common.exceptions.CommandNotAllowed]

Checks whether this command is allowed It checks that the device is in the right state to execute this command and that all the component needed for the operation are not unresponsive

Returns:

True if this command is allowed

Return type:

boolean

property lrc_result: Tuple[str, str]

Returns the longRunningCommandResult attribute.

Returns:

the longRunningCommandResult

Return type:

spectrum

off(task_callback: ska_tango_base.base.TaskCallbackType) Tuple[ska_tango_base.executor.TaskStatus, str]

Submits the Off command for execution.

Return type:

tuple

on(task_callback: ska_tango_base.base.TaskCallbackType) Tuple[ska_tango_base.executor.TaskStatus, str]

Submits the On command for execution.

Return type:

tuple

raise_invalid_obsstate_error(command_name: str) ska_tmc_common.exceptions.InvalidObsStateError

checking the InvalidObsState of SdpSubarray device :param command_name: The name of command :type command_name: str

release_all_resources(task_callback: ska_tango_base.base.TaskCallbackType) Tuple[ska_tango_base.executor.TaskStatus, str]

Submits the ReleaseAllResources command for execution.

Return type:

tuple

restart(task_callback: Optional[ska_tango_base.base.TaskCallbackType] = None) Tuple[ska_tango_base.executor.TaskStatus, str]

Submit the Restart command in queue.

Returns:

a result code and message

scan(argin: str, task_callback: ska_tango_base.base.TaskCallbackType) Tuple[ska_tango_base.executor.TaskStatus, str]

Submits the Scan command for execution.

Return type:

tuple

standby(task_callback: Optional[Callable] = None) None

Standby command is not implemented by SDP Subarray Leaf Node device.

start_communicating() None

Establish communication with the component, then start monitoring.

This is the place to do things like:

  • Initiate a connection to the component (if your communication is connection-oriented)

  • Subscribe to component events (if using “pull” model)

  • Start a polling loop to monitor the component (if using a “push” model)

stop()

Method used to Stop the liveliness probe and event receiver for given devices.

stop_communicating() None

Cease monitoring the component, and break off all communication with it.

For example,

  • If you are communicating over a connection, disconnect.

  • If you have subscribed to events, unsubscribe.

  • If you are running a polling loop, stop it.

update_command_result(command_name: str, value: str) None

Updates the long running command result callback

update_device_obs_state(obs_state: ska_tango_base.control_model.ObsState) None

Update a monitored device obs state, and call the relative callbacks if available

Parameters:

obs_state (ObsState) – obs state of the device

update_device_ping_failure(device_info: ska_tmc_common.device_info.SubArrayDeviceInfo, exception: str) None

Set a device to failed and call the relative callback if available

Parameters:
  • device_info (DeviceInfo) – a device info

  • exception – an exception

Type:

Exception

update_event_failure() None

Update event failures

update_ping_info(ping: int, device_name: str) None

Update a device with the correct ping information.

Parameters:
  • device_name (str) – name of the device

  • ping (int) – device response time

class ska_tmc_sdpsubarrayleafnode.manager.SdpSLNEventReceiver(*args: Any, **kwargs: Any)

Bases: EventReceiver

The SdpSLNEventReceiver class has the responsibility to receive events from the sub devices managed by the Sdp Subarray Leaf Node.

The ComponentManager uses the handle events methods for the attribute of interest. For each of them a callback is defined.

handle_obs_state_event(event)

Method to handle and update the latest value of obsState attribute. :param event: to flag the :type event: tango.EventType :param change in event.:

run()
subscribe_events(dev_info: ska_tmc_common.device_info.SubArrayDeviceInfo, attribute_dictionary: Optional[Dict[str, str]] = None)