Long Running Commands Client API

This module provides a convenience client API for invoking long running commands.

ska_tango_base.long_running_commands.api.invoke_lrc(lrc_callback: LRCCallbackType, proxy: DeviceProxy, command: str, command_args: tuple[Any] | None = None, logger: Logger | None = None, *, callback_scheduler: CallbackScheduler | None = None) LRCSubscriptionsProtocol[source]

Invoke a long running command (LRC) and monitor its progress with callbacks.

Subscribe to the relevant LRC attributes and inform the client about change events via the provided lrc_callback with either the status, progress, result or error.

Parameters:
  • lrc_callback – Client LRC callback to call whenever the LRC’s state changes.

  • proxy – Tango DeviceProxy.

  • command – Name of command to invoke.

  • command_args – Optional arguments for the command, defaults to None.

  • logger – Logger to use for logging exceptions. If not provided, then a default module logger will be used.

Returns:

An object modelling LRCSubscriptionsProtocol, containing the command ID. A reference to the instance must be kept until the command is completed or the client is not interested in its events anymore, as deleting the instance unsubscribes from the LRC change events and thus stops any further callbacks.

Raises:
  • CommandError – If the command is rejected.

  • ResultCodeError – If the command returns an unexpected result code.

  • ValueError – If the lrc_callback does not accept **kwargs.

  • RuntimeError – If the supported client-server protocol versions do not overlap.

ska_tango_base.long_running_commands.api.connect_lrc_interface(device: DeviceProxy, scheduler: CallbackScheduler | None = None) None[source]

Connect a CallbackScheduler to the LRC interface of a device.

Pre-connecting to the LRC interface can speed up multiple calls to invoke_lrc as they no longer have to connect the event streams individually.

Parameters:
  • device – the device to connect to

  • scheduler – scheduler to connect with or None for the global scheduler

ska_tango_base.long_running_commands.api.disconnect_lrc_interface(device: DeviceProxy, scheduler: CallbackScheduler | None = None) None[source]

Disconnect a CallbackScheduler from the LRC interface of a device.

Parameters:
  • device – the device to connect to

  • scheduler – scheduler to connect with or None for the global scheduler