Tile Orchestrator

This module provides a orchestrator for the tile component manager.

class Stimulus(value)

An enumerated type for a stimulus upon which this orchestrator acts.

TODO: This is only public because it is exposed for testing purposes through the API, so sphinx needs it to be public when building the docs. We should refactor so that we can hide this.

DESIRE_OFF = 4

The tile device has been asked to turn off the TPM.

DESIRE_OFFLINE = 1

The tile device has been asked to start communicating with the TPM.

DESIRE_ON = 3

The tile device has been asked to turn on the TPM.

DESIRE_ONLINE = 2

The tile device has been asked to stop communicating with the TPM.

SUBRACK_COMMS_ESTABLISHED = 6

Communications with the subrack device is established.

SUBRACK_COMMS_NOT_ESTABLISHED = 5

Communications with the subrack device is not established.

SUBRACK_SAYS_TPM_NO_SUPPLY = 8

The subrack reports that the TPM has no power supply.

That is, the subrack itself is off. Thus, the TPM is off, and it cannot be commanded on

SUBRACK_SAYS_TPM_OFF = 9

The subrack reports that the TPM is off.

However the subrack itself is on, so the TPM can be commanded on.

SUBRACK_SAYS_TPM_ON = 10

The subrack reports that the TPM is powered on.

SUBRACK_SAYS_TPM_UNKNOWN = 7

The subrack reports that power state of the TPM is unknown.

TPM_COMMS_ESTABLISHED = 12

Communications with the TPM is established.

TPM_COMMS_NOT_ESTABLISHED = 11

Communications with the TPM is not established.

class TileOrchestrator(start_communicating_with_subrack_callback, stop_communicating_with_subrack_callback, start_communicating_with_tpm_callback, stop_communicating_with_tpm_callback, turn_tpm_off_callback, turn_tpm_on_callback, communication_state_changed_callback, component_power_changed_callback, logger, _initial_state=None)

A orchestrator for the Tile component manager.

Orchestrators receive stimuli from the environment of their component manager, and decide on actions to take in response. They are the “brains” of the component manager.

In this case, the stimuli consist of:

  • the actions of the operator (such as desiring the TPM to be turned on.

  • changes to the state of the TPM or our communications with it.

  • changes to the state of the subrack that supplies power to the TPM, or our communications with it.

The actions this orchestrator can take in response to these stimuli include:

  • Establishing or breaking off communication with the subrack

  • Establishing or breaking off communication with the TPM

  • Telling the subrack to turn the TPM off / on

  • Calling callbacks that update the monitored state of the component

The specific actions are defined in a YAML file as follows: literalinclude:: ../../../../src/ska_low_mccs_spshw/tile/orchestration_rules.yaml :language: yaml

__init__(start_communicating_with_subrack_callback, stop_communicating_with_subrack_callback, start_communicating_with_tpm_callback, stop_communicating_with_tpm_callback, turn_tpm_off_callback, turn_tpm_on_callback, communication_state_changed_callback, component_power_changed_callback, logger, _initial_state=None)

Initialise a new instance.

Parameters:
  • start_communicating_with_subrack_callback (Callable[[], None]) – callback to be called in order to initiate communication with the subrack.

  • stop_communicating_with_subrack_callback (Callable[[], None]) – callback to be called in order to break off communication with the subrack.

  • start_communicating_with_tpm_callback (Callable[[], None]) – callback to be called in order to initiate communication with the TPM.

  • stop_communicating_with_tpm_callback (Callable[[], None]) – callback to be called in order to break off communication with the TPM.

  • turn_tpm_off_callback (Callable[[], Any]) – callback to be called in order to turn off the TPM

  • turn_tpm_on_callback (Callable[[], Any]) – callback to be called in order to turn on the TPM

  • communication_state_changed_callback (Callable[[CommunicationStatus], None]) – callback to be called in order to indicate a change in the status of communication between the component manager and its TPM

  • component_power_changed_callback (Callable[[PowerState], None]) – callback to be called when the component power state changes

  • logger (Logger) – a logger to be used by this orchestrator.

  • _initial_state (Union[tuple[CommunicationStatus], tuple[CommunicationStatus, Optional[bool], PowerState], tuple[CommunicationStatus, Optional[bool], PowerState, CommunicationStatus], None]) – set the initial state of this tile orchestrator. This is provided for unit testing purposes and should not be used outside of unit tests.

desire_off(task_callback=None, task_abort_event=None)

Advise that the operator desires the TPM to be off.

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

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

Raises:

Exception – if the TileOrchestrator encounters an unhandled case

Return type:

None

desire_offline()

Advise that the operator desires the component manager to be offline.

Return type:

None

desire_on(task_callback=None, task_abort_event=None)

Advise that the operator desires the TPM to be on.

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

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

Raises:

Exception – if the TileOrchestrator encounters an unhandled case

Return type:

None

desire_online()

Advise that the operator desires the component manager to be online.

Return type:

None

desire_standby(task_callback=None, task_abort_event=None)

Advise that the operator desires the TPM to be standby.

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

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

Raises:

Exception – if the TileOrchestrator encounters an unhandled case

Return type:

None

propogate_subrack_lrc(event_name, event_value, event_quality)

Call LRC callbacks to reflect changes in the subrack.

This is needed as there are LRCs which call subrack LRCs: (desire_on, desire_off, desire_standby) Therefore the initial LRC callback needs to get called when the subsequent LRC on the subrack completes

Parameters:
  • event_name (str) – the name of the event, which will always be longrunningcommandresult

  • event_value (tuple[str, str]) – a tuple containing the unique id and message from the LRC

  • event_quality (AttrQuality) – the quality of the change event

Return type:

None

update_subrack_communication_state(communication_state)

Update status of communications between the component manager and the subrack.

Parameters:

communication_state (CommunicationStatus) – the new current status of communications between the component manager and the subrack.

Raises:

NotImplementedError – if the provided communication status is unsupported.

Return type:

None

update_tpm_communication_state(communication_state)

Update status of communications between the component manager and the TPM.

Parameters:

communication_state (CommunicationStatus) – the new current status of communications between the component manager and the TPM.

Raises:

NotImplementedError – if the provided communication status is unsupported.

Return type:

None

update_tpm_power_state(power_state)

Update the current power state of the TPM.

Parameters:

power_state (PowerState) – the current power state of the TPM.

Raises:

NotImplementedError – if the provided power state is unsupported.

Return type:

None