Component Command

class ska_csp_lmc_common.commands.component_command.ComponentCommand(name: str, component: Component, resources: Any | None = None, logger: Logger | None = None)

Bases: BaseComponentCommand

Abstract class to model a sub-system (or component) command.

A component command operates on a CSP subordinate sub-system.

__init__(name: str, component: Component, resources: Any | None = None, logger: Logger | None = None) None

Class init method.

Parameters:
  • name – the command name

  • component (Component) – the subsystem component on which the command acts

  • resources – the command input argument, if any (default None)

  • logger – the device logger

property component: Component

Return the sub-system receiver of the command.

Returns:

the sub-system component the command acts on

run() None

Method to execute the command on the receiver component.

failure_detected()

Return whether a failure was detected during command execution.

Failure conditions are: - Timeout expired - Failure in command execution on a sub-system - Sub-system reports FAULT obsState.

command_ended()

Helper function called when the command ends on the sub-system component. It evaluates the command execution time and invokes the observer notify method.

notify method.

_command_monitor() None

Thread target function.

Issue the command on the target sub-system component and monitor the command status, waiting for the end of the command. The process is regulated via a timeout. The command completion (either with success or failure) is notified to the main command observer (instantiate into the ComponentManager) invoking the notify method on it. On exception, the failure_raised flag is set.

_run(argument: Any | None = None, callback: Callable | None = None) None

If not specialized simply calls the run method on the corresponding component.