Macro Component Commands
- class ska_csp_lmc_common.commands.macro_command.MacroComponentCommand(name: str, command_factory: CommandFactory, notify_callback: Callable, macro_items: List[MacroCommandItem], timeout: int | None = 0, logger: Logger | None = None, abort_event: Event | None = None)
Bases:
BaseComponentCommand
Class modeling a Macro command.
A Macro-command is a set of sub-system or component commands grouped together as a single command and executed in sequence, one after the other, to accomplish a CSP task. Sub-system commands can have different sub-system targets.
- __init__(name: str, command_factory: CommandFactory, notify_callback: Callable, macro_items: List[MacroCommandItem], timeout: int | None = 0, logger: Logger | None = None, abort_event: Event | None = None)
- Parameters:
name – the name of the macro command.
command_factory – the factory class to create the CSP Component commands classes.
notify_callback – the observer method invoked at command completion.
macro_items – a list of MacroCommandItem entries
logger – the device logger target
abort_event – the event set on abort request.
- property command_in_execution
Return the command currently in execution.
- property is_running: bool
Whether the macro-command is running.
The macro command is running if at least one of its components command is in running state
TO REMOVE when move to BC13
- property failure_raised: bool
Whether the macro-command failure flag is set.
The macro command failure flag is set when at least one of its components command is failed.
TO REMOVE when move to BC13
- property timeout_expired: bool
Whether the macro-command timeout expired flag is set.
The macro command timeout flag is set when at least one of its components command elapsed its timeout.
- property aborted: bool
Flag to report whether an abort request has been process by the CSP sub-system.
- Returns:
whether an abort request has been processed by the sub-system.
- property exec_duration: float
Report the effective command execution time.
- Returns:
the command execution time in secs.
- add(command: ComponentCommand)
Add a sub-task command
- tag()
Tag the command of the macro command Each component command is tagged with two numbers: - the order in the list of execution - the total number of commands belonging to the macro command
- command_ended()
Invoked on command completion.
- status_ok()
Invoked on command completion.
- _command_monitor()
Method to run and monitor the execution of a macro command.
Component commands are executed one after the other. Each component command notifies its end to the command observer. If one command fails, the other commands are skipped.
TODO: This behavior does not apply to all the type of commands: need to configure this functionality.
- run() None
Method to execute the command on the receiver component.