Skip to main content

RunRecord

Struct RunRecord 

Source
pub struct RunRecord {
Show 14 fields pub run: RunId, pub itinerary: ItineraryId, pub agent: AgentName, pub pipeline: Option<PipelineName>, pub model: Option<String>, pub outcome: Outcome, pub started_at: Timestamp, pub finished_at: Option<Timestamp>, pub usd: f64, pub source: CostSource, pub usage: TokenUsage, pub detail: Option<String>, pub blocked_on: Option<String>, pub pid: Option<u32>,
}
Expand description

One supervised CLI execution, as recorded in history.

Serialised one per line as JSON. Field names are the wire format: renaming one silently orphans every record already on disk, so treat them as an API.

Fields§

§run: RunId

The run.

§itinerary: ItineraryId

The chain it belonged to.

§agent: AgentName

Which agent was run.

§pipeline: Option<PipelineName>

The pipeline that started the chain, when one did.

§model: Option<String>

Which model, when the runner said.

§outcome: Outcome

How it ended.

§started_at: Timestamp

When it started.

§finished_at: Option<Timestamp>

When it ended, or None while it is still going.

§usd: f64

Cost in US dollars.

§source: CostSource

Where usd came from.

§usage: TokenUsage

Tokens consumed, as far as they are known.

§detail: Option<String>

Why it ended, for the outcomes where that is not obvious.

§blocked_on: Option<String>

What the run could not get past, when it asked for help.

Present whether or not the run succeeded, because the two are independent: an agent can finish its task and still have been unable to check something. Without this a blocked run looks exactly like a clean one on a list, which is the failure mode a lights-out factory can least afford — the detail lives with the help request, and this is the one line that makes the run worth opening.

§pid: Option<u32>

The operating system process id, while the run is live.

Recorded so that a Tower coming back from a restart can check whether the process is still there rather than assume. A child routinely outlives the parent that spawned it on Windows, and recovering beside a process that never stopped duplicates its work — see crate::handover::ChildState.

A recycled process id can make a dead run look alive, which fails towards refusing to recover. That is the safe direction: stalled work is visible, duplicated work is not.

Implementations§

Source§

impl RunRecord

Source

pub fn started( run: RunId, itinerary: ItineraryId, agent: AgentName, started_at: Timestamp, ) -> Self

Records a run that has just started.

Source

pub fn from_pipeline(self, pipeline: PipelineName) -> Self

Attributes the run to the pipeline that started its chain.

Source

pub fn using_model(self, model: impl Into<String>) -> Self

Notes which model the runner used.

Source

pub fn finished(self, outcome: Outcome, at: Timestamp) -> Self

Closes the run out with an outcome and a finishing time.

Source

pub fn costing(self, usd: f64, source: CostSource, usage: TokenUsage) -> Self

Attaches what the run cost.

Source

pub fn because(self, detail: impl Into<String>) -> Self

Explains an outcome that is not self-evident.

Source

pub fn blocked_on(self, summary: impl Into<String>) -> Self

Notes that the run asked for help, and what about.

Source

pub fn needed_help(&self) -> bool

Returns true when the run reported something in its way.

Source

pub fn with_pid(self, pid: u32) -> Self

Notes the process id, so a later Tower can check whether it is still running.

Source

pub fn duration_secs(&self) -> Option<i64>

How long the run took, in whole seconds, or None while it is still going.

Returns None rather than a negative number if the clock went backwards between the two readings, which NTP correction can do: a negative duration on a dashboard is worse than an absent one, because somebody will average it.

Source

pub fn filed_at(&self) -> Timestamp

The instant this record should be filed under.

Runs are filed by when they finished, matching the cost ledger, so that a total for a period covers the runs whose money landed in it. A long run started before a window and finished inside it belongs to the window it was paid for.

Trait Implementations§

Source§

impl Clone for RunRecord

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RunRecord

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for RunRecord

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for RunRecord

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for RunRecord

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for RunRecord

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V