CommandFutures¶
- class lsst.ts.mtmount.CommandFutures(command)¶
Bases:
object
asyncio futures to track the progress of a low-level controller command.
- Parameters:
- command
commands.Command
The command.
- command
- Attributes:
- ack
asyncio.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).
- done
asyncio.Future
Future which ends as follows:
result =
None
when the command finishes successfully.exception =
lsst.ts.salobj.ExpectedError
if the command is rejected or fails.
- ack
Attributes Summary
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:
- timeout
float
Max time for command to complete (sec).
- timeout
- 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:
- explanation
str
Explanation of what went wrong.
- explanation
Notes
Sets the
ack
(if not done) elsedone
future tolsst.ts.salobj.ExpectedError
exception.Do not set both, to avoid “exception was never retrieved” warnings.