CommandProviderSession
CommandProviderSession — one command’s lifecycle through the ICD state machine.
Each CommandProviderSession is created by CommandProvider when a new
command arrives. It drives the state machine via an inline while-loop with
if/elif dispatch. _transition_to() validates every state change.
External actors (cancel, fail, update) communicate via methods that set terminal state or pending-update flag; the run loop checks at natural checkpoints.
- class rtiumaapy.command_provider_session.CommandProviderSession(provider: CommandProvider, command)[source]
Bases:
objectManages one command’s lifecycle through the ICD state machine.
Created by
CommandProviderfor each incoming command.run()walks through states with if/elif dispatch._transition_to()validates every transition.cancel()/fail()set the terminal state and publish before cancelling the task.set_new_command()stores the pending update.- property command
The current command sample.
- property session_id: str
The session ID string.
- property current_state: int | None
The current state machine state.
- async cancel() None[source]
Consumer disposed command → CANCELED.
Sets terminal state, publishes, then cancels the task.
- async fail() None[source]
Provider shutdown → FAILED(SERVICE_FAILED).
Sets terminal state, publishes, then cancels the task.
Overview
Each CommandProviderSession is created by CommandProvider when a new
command arrives. It manages one command’s lifecycle through the ICD state
machine. You interact with sessions through the provider hooks — you rarely
need to call session methods directly.
Properties
Property |
Type |
Description |
|---|---|---|
|
IDL struct |
The current command sample |
|
|
The session GUID string |
|
|
Current state machine state |
State Transitions
Valid transitions and their failure reasons (per ICD D51):
None → ISSUED
Failure reasons: SERVICE_FAILED
ISSUED → COMMANDED
Failure reasons: SERVICE_FAILED, INTERRUPTED, TIMEOUT,
RESOURCE_FAILED, VALIDATION_FAILED
COMMANDED → EXECUTING
Failure reasons: SERVICE_FAILED, INTERRUPTED, TIMEOUT,
RESOURCE_REJECTED
EXECUTING → COMPLETED
Failure reasons: SERVICE_FAILED, INTERRUPTED, TIMEOUT,
RESOURCE_FAILED, OBJECTIVE_FAILED
Any non-terminal → CANCELED (via dispose)
Enums
from rtiumaapy.command_provider_session import (
CommandStatusEnum, # ISSUED, COMMANDED, EXECUTING, COMPLETED, FAILED, CANCELED
CommandReasonEnum, # SUCCEEDED, CANCELED, VALIDATION_FAILED, etc.
)