PSS Ctrl Pipeline Component Manager

class ska_pss_lmc.pipeline.pipeline_component_manager.PipelineCtrlComponentManager(max_workers, properties, communication_status_changed_callback, component_state_changed_callback, update_device_attribute_cbk, logger=None)

Bases: TaskExecutorComponentManager

A base component manager for PSS Pipeline Control Device.

property pipeline_configured: bool

Return a flag that states if the pipeline is already configured. 3

It is used in case of re-configuration by the _configure_scan method to properly trigger the state machine.

Return type

bool

property is_communicating: bool

Return whether communication with the component is established.

Return type

bool

Returns

whether there is currently a connection to the component

property log_line: str

Stores the last line of pipeline log

Return type

str

property pipeline_progress: int

Stores the last line of percentage progress of the pipeline

Return type

int

property cheetah_version: str

Return the version of Cheetah pipeline in use.

NOTE: to be implemented

Return type

str

property cheetah_pid: int

Return the pid of the cheetah process

Return type

int

property scan_configuration: str

Return the JSON script used to configure the pipeline.

Return type

str

create_communication_manager(logger)

Instantiate the communication manager to access Cheetah.

Parameters

logger (Logger) – a logger for this instance to use.

Return type

SshAccess

update_component_state(**kwargs)

Handle a change in component state.

Override the BaseComponentManager _update_component_state() method. It invokes the device _component_state_changed method that performs action on the state machine, as required.

Return type

None

_push_component_state_update(**kwargs)
start_communicating()

Try to open a connection with the PSS Node.

Open a channel with this instance of the component manager and the software component (cheetah pipeline). Submit the _start_communicating method Initial communication status is DISABLED.

Return type

None

_start_communicating_callback(status, communication_status=None, exception=None, message=None)

Task callback passed when submitting the task of _start_communicating.

Param

status: the status of the task

Param

communicationStatus: the status of communication to be reported to the Pipeline device

Param

exception: possible exception raised when submitting the task

Param

message: possible message received when submitting the task

Return type

None

_start_communicating(task_callback=None, task_abort_event=None)

Task submitted by start_communicating.

On failure the communication status is reported as NOT_ESTABLISHED and the adminMode as ONLINE/MAINTENANCE. The state of the device is set to UNKNOWN. Need to re-try the connection.

Param

task_callback: Task callback passed during the submission of the task

Param

task_abort_event: the abort event (still not implemented)

Return type

None

_monitor_scan()

Method invoked at connection when the pipeline process is running.

stop_communicating()

Close connection with the software component.

Close the ssh channel between this instance of the component manager and the controlled software component (cheetah). The communication state variable is set to DISCONNECTED and the adminMode to OFFLINE.

Return type

None

end_scan(task_callback=None)

Shutdown pipeline.

Return type

Tuple[TaskStatus, str]

_endscan(task_callback=None, task_abort_event=None)
abort(task_callback=None)

Terminate pipeline.

If the cheetah pipeline is running, it is stopped. If the command is invoked when no observation is in running, the device transition to ABORTED.

Return type

Tuple[TaskStatus, str]

_abort(task_callback=None, task_abort_event=None)

Task submitted by the task executor on abort request.

Check if the pipeline is running and in this case, it sets the abort event and invokes the termination of the process.

Return type

None

configure_scan(json_configuration, task_callback=None)

Store the configuration file on PSS Node.

The received configuration file is translated in XML format and stored on the PSS node to be used at pipeline startup.

The original configuration in JSON format is also stored into an instance property.

Param

json_configuration: a string containing the Json configuration

Param

task_callback: the callback invoked when command ends

Return type

Tuple[TaskStatus, str]

_config_scan(json_configuration, task_callback=None, task_abort_event=None)
scan(scan_id, task_callback=None)

Start cheetah pipeline on the PSS Node.

Run Cheetah pipeline This method is meant to run in its own worker thread, as it is a long running command.

Param

scan_id: an integer the identify the scan

Param

task_callback: the callback invoked when command ends

Return type

None

_scan(cmd_string, task_callback=None, task_abort_event=None)

Task submitted by the active thread of the pool.

Parameters
  • cmd_string (str) – the command line to run cheetah

  • task_callback (Optional[Callable]) – the CommandTracker callback invoked when the command complete

  • task_abort_event (Optional[Event]) – the abort event

Return type

None

_parse_logs(task_callback=None)

Parse and forward logs from the cheetah application.

Parameters

task_callback (Optional[Callable]) – CommandTracker method invoked on command completion.

reset_to_idle(task_callback=None)

Submit a task to reset the observing state to IDLE.

This method is invoked both by the ObsReset and GoToIdle commands.

Parameters

task_callback (Optional[Callable]) – CommandTRacker method invoked on command completion.

Return type

Tuple[str, str]

Returns

a tuple with the task status and a message

obsreset(task_callback=None)

Reset the device from a FAULT/ABORT condition.

Parameters

task_callback (Optional[Callable]) – CommandTRacker method invoked on command completion.

Return type

Tuple[str, str]

Returns

a tuple with the task status and a message

deconfigure(task_callback=None)

Transition the device from READY to IDLE.

Return type

Tuple[str, str]

Returns

a tuple with the task status and a message

_reset_to_idle(task_callback=None, task_abort_event=None)

Task submitted by the reset_to_idle method.

Parameters
  • task_callback (Optional[Callable]) – CommandTRacker method invoked on command completion.

  • task_abort_event (Optional[Event]) – the shared event to signal an abort request.