CommandFutures

class lsst.ts.mtmount.CommandFutures(command)

Bases: object

asyncio futures to track the progress of a low-level controller command.

Parameters:
commandcommands.Command

The command.

Attributes:
ackasyncio.Future

Future which ends as follows:

  • result = timeout (in sec) when the command is acknowledged, and the command is not one of those that is done when acknowledged.

  • exception = lsst.ts.salobj.ExpectedError if the command is rejected (fails before it is acknowledged).

doneasyncio.Future

Future which ends as follows:

Attributes Summary

timeout

Return the timeout, in seconds.

Methods Summary

setack(timeout)

Report a command as started.

setdone()

Report a command as finished successfully.

setnoack(explanation)

Report a command as failed.

Attributes Documentation

timeout

Return the timeout, in seconds.

Return None if command not acknowledged. Raise an exception if the command failed before being acknowledged.

Raises:
InvalidStateError

If ack is not done.

CancelledError

If ack was cancelled.

The exception set by asyncio.Future.set_exception

If ack was set to an exception.

Methods Documentation

setack(timeout)

Report a command as started.

Call this when the command receives ReplyId.CMD_ACKNOWLEDGED, but only if the command is not done (a few commands are done when acknowledged). If the command is done, call setdone.

Parameters:
timeoutfloat

Max time for command to complete (sec).

setdone()

Report a command as finished successfully.

Call this if the command receives ReplyId.CMD_SUCCEEDED, or if it is one of the few commands that is done when acknowledged and the command receives ReplyId.CMD_ACKNOWLEDGED.

setnoack(explanation)

Report a command as failed.

Call this if the command receives ReplyId.CMD_REJECTED or ReplyId.CMD_FAILED.

Parameters:
explanationstr

Explanation of what went wrong.

Notes

Sets the ack (if not done) else done future to lsst.ts.salobj.ExpectedError exception.

Do not set both, to avoid “exception was never retrieved” warnings.