SKA Commands

This module provides abstract base classes for device commands, and a ResultCode enum.

class ska_tango_base.commands.ActionCommand(target, state_model, action_hook, start_action=False, logger=None)

Abstract base class for a tango command, which checks a state model to find out whether the command is allowed to be run, and after running, sends an action to that state model, thus driving device state.

check_allowed()

Checks whether the command is allowed to be run in the current state of the state model.

Returns:True if the command is allowed to be run
Raises:StateModelError – if the command is not allowed to be run
failed()

Callback for the failed completion of the command.

is_allowed()

Whether this command is allowed to run in the current state of the state model.

Returns:whether this command is allowed to run
Return type:boolean
started()

Action to perform upon starting the comand.

succeeded()

Callback for the successful completion of the command.

class ska_tango_base.commands.BaseCommand(target, state_model, logger=None)

Abstract base class for Tango device server commands. Ensures the command is run, and that if the command errors, the “fatal_error” action will be called on the state model.

do(argin=None)

Hook for the functionality that the command implements. This class provides stub functionality; subclasses should subclass this method with their command functionality.

Parameters:argin (ANY) – the argument passed to the Tango command, if present
fatal_error()

Callback for a fatal error in the command, such as an unhandled exception.

class ska_tango_base.commands.ResponseCommand(target, state_model, logger=None)

Abstract base class for a tango command handler, for commands that execute a procedure/operation and return a (ResultCode, message) tuple.

class ska_tango_base.commands.ResultCode

Python enumerated type for command return codes.

FAILED = 3

The command could not be executed.

OK = 0

The command was executed successfully.

QUEUED = 2

The command has been accepted and will be executed at a future time

STARTED = 1

The command has been accepted and will start immediately.

UNKNOWN = 4

The status of the command is not known.