Skip to content

@usine/engine/step-executor

The saved Event, effective task and Agent, and Step being tried in one Attempt.

  • Schema.Class

new StepExecution(…args): StepExecution

Parameter Type
…args [props: object, options?: MakeOptions]

StepExecution

readonly agent: Agent

readonly attempt: Attempt

readonly event: Event

readonly parentModel: Option<string & Brand<"ModelId">>

readonly reattach: boolean

The Attempt was open when the orchestrator stopped and its parent task is still live: execution reattaches to it instead of starting it.

readonly repository: string & Brand<"RepositoryName">

readonly resume: Option<SalvagePushed>

The newest pushed salvage of an earlier Attempt of this Run, which this Attempt’s checkout resumes from.

readonly revision: string & Brand<"RepositoryRevision">

readonly run: Run

readonly step: Step

readonly task: string & Brand<"AttemptTask">


Runs one Attempt on a Worker: reserve capacity, execute the step, interrupt on cancel.

  • Context.ServiceClass

readonly Service: object

The service’s operations: what yield* StepExecutor returns.

readonly execute: (execution, io) => Effect.Effect<StepResult, AttemptFailure>

Runs the reserved Attempt, or reattaches to it when execution.reattach is set, recording channel activity through io, and waits for its result.

Parameter Type
execution StepExecution
io Sink

Effect.Effect<StepResult, AttemptFailure>

readonly interrupt: (attemptId) => Effect.Effect<void, AttemptFailure>

Requests that the identified Attempt stop its current work.

Parameter Type
attemptId AttemptId

Effect.Effect<void, AttemptFailure>

readonly intervene: (attemptId, intervention) => Effect.Effect<void, AttemptFailure>

Sends a nonterminal operator action to a live session in the identified Attempt.

Parameter Type
attemptId AttemptId
intervention Intervention

Effect.Effect<void, AttemptFailure>

readonly isLive: (attemptId) => Effect.Effect<boolean, AttemptFailure>

Whether the Attempt’s parent task outlived an orchestrator restart, so its Run reattaches it instead of opening the next Attempt: the task still runs, or it finished and its result still has to be collected from the Worker.

Parameter Type
attemptId AttemptId

Effect.Effect<boolean, AttemptFailure>

readonly outcome: (attemptId) => Effect.Effect<Option.Option<Result.Result<StepResult, AttemptFailure>>, AttemptFailure>

The result an open Attempt’s parent task stored before an orchestrator restart, which its Run never recorded. The Run finishes the Attempt with it instead of failing it as interrupted; none when nothing was stored.

Parameter Type
attemptId AttemptId

Effect.Effect<Option.Option<Result.Result<StepResult, AttemptFailure>>, AttemptFailure>

readonly recover: <E>(attempt, record) => Effect.Effect<void, E | AttemptFailure>

Reconciles an old checkout before new Attempts start; records its salvage before releasing any work.

Type Parameter
E
Parameter Type
attempt AttemptRecovery
record (salvage) => Effect.Effect<void, E>

Effect.Effect<void, E | AttemptFailure>

readonly reserve: (submission) => Effect.Effect<WorkerLease, AttemptFailure>

Waits for Worker capacity; the returned lease must be released after execution or cancellation.

Parameter Type
submission Submission

Effect.Effect<WorkerLease, AttemptFailure>

A reservation of one Worker’s capacity for the length of an Attempt. Call release when the Attempt ends.

readonly release: Effect<void>

readonly worker: string & Brand<"WorkerName">