pub struct CommandExecution {Show 16 fields
pub id: Uuid,
pub task_id: TaskId,
pub run_id: RunId,
pub command: String,
pub working_dir: String,
pub command_class: CommandClass,
pub state: CommandState,
pub queued_at: DateTime<Utc>,
pub started_at: Option<DateTime<Utc>>,
pub ended_at: Option<DateTime<Utc>>,
pub exit_code: Option<i32>,
pub idempotency_key: Option<String>,
pub correlation_id: CorrelationId,
pub chunk_count: u64,
pub resource_usage: Option<CommandResourceUsage>,
pub token_usage: Option<TokenUsage>,
}Expand description
An immutable record of a command execution.
Fields§
§id: UuidUnique command execution ID.
task_id: TaskIdThe task that owns this command.
run_id: RunIdThe run this command belongs to.
command: StringCommand string (program + arguments).
working_dir: StringWorking directory for the command.
command_class: CommandClassCommand class for concurrency accounting.
state: CommandStateCurrent FSM state.
queued_at: DateTime<Utc>When the command was queued.
started_at: Option<DateTime<Utc>>When the command started executing.
ended_at: Option<DateTime<Utc>>When the command finished (exited/timed-out/killed).
exit_code: Option<i32>Process exit code (None if not yet exited or killed).
idempotency_key: Option<String>Idempotency key for deduplication of side-effecting commands.
correlation_id: CorrelationIdCorrelation ID.
chunk_count: u64Number of stdout/stderr chunks collected.
resource_usage: Option<CommandResourceUsage>Captured process resource usage for this command.
token_usage: Option<TokenUsage>Token usage associated with this command execution.
Implementations§
Source§impl CommandExecution
impl CommandExecution
Sourcepub fn new(
task_id: TaskId,
run_id: RunId,
command: impl Into<String>,
working_dir: impl Into<String>,
command_class: CommandClass,
correlation_id: CorrelationId,
) -> Self
pub fn new( task_id: TaskId, run_id: RunId, command: impl Into<String>, working_dir: impl Into<String>, command_class: CommandClass, correlation_id: CorrelationId, ) -> Self
Create a new command execution in CmdQueued state.
Sourcepub fn with_idempotency_key(self, key: impl Into<String>) -> Self
pub fn with_idempotency_key(self, key: impl Into<String>) -> Self
Set an idempotency key for deduplication.
Sourcepub fn transition(
&mut self,
to: CommandState,
reason: impl Into<String>,
actor: impl Into<String>,
causation_id: Option<EventId>,
) -> Result<Transition, TransitionError>
pub fn transition( &mut self, to: CommandState, reason: impl Into<String>, actor: impl Into<String>, causation_id: Option<EventId>, ) -> Result<Transition, TransitionError>
Attempt a state transition. Returns a Transition event on success.
Sourcepub fn exit(
&mut self,
exit_code: i32,
actor: impl Into<String>,
causation_id: Option<EventId>,
) -> Result<Transition, TransitionError>
pub fn exit( &mut self, exit_code: i32, actor: impl Into<String>, causation_id: Option<EventId>, ) -> Result<Transition, TransitionError>
Record a successful exit with exit code.
Trait Implementations§
Source§impl Clone for CommandExecution
impl Clone for CommandExecution
Source§fn clone(&self) -> CommandExecution
fn clone(&self) -> CommandExecution
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CommandExecution
impl Debug for CommandExecution
Source§impl<'de> Deserialize<'de> for CommandExecution
impl<'de> Deserialize<'de> for CommandExecution
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for CommandExecution
impl RefUnwindSafe for CommandExecution
impl Send for CommandExecution
impl Sync for CommandExecution
impl Unpin for CommandExecution
impl UnsafeUnpin for CommandExecution
impl UnwindSafe for CommandExecution
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request