pub struct WorkflowRunner { /* private fields */ }Expand description
General-purpose workflow execution engine.
Resolves action steps through VFS /bin/ ctl files and evaluates
script steps via TclShell on spawn_blocking threads. Concurrent
script-executing jobs are capped by script_semaphore.
§Scheduling (#527)
Each job is routed through an optional JobScheduler: runs_on: +
resources: decide in-proc execution (unchanged) vs. a real sandbox
reservation acquired through the #525 P2 admission engine. With no
scheduler configured (the default), every job runs in-proc exactly as
before this change — no regression for existing callers.
§Run-level concurrency + timeouts (#521)
run_semaphore bounds concurrent workflow runs (WorkflowConfig:: max_concurrent_runs) — a different axis from script_semaphore, which
bounds concurrent script-executing jobs within/across runs.
job_timeout/step_timeout (job_timeout_secs/step_timeout_secs) wrap
job and step execution in tokio::time::timeout; a job’s own
timeout-minutes: overrides job_timeout when present.
Implementations§
Source§impl WorkflowRunner
impl WorkflowRunner
Sourcepub fn new(ns: Arc<Namespace>) -> Self
pub fn new(ns: Arc<Namespace>) -> Self
Create a new WorkflowRunner with WorkflowConfig::default() timeouts/
concurrency and no job scheduler (every job runs in-proc).
ns— the root namespace (mounts for/bin/,/env/,/srv/, etc.)- Default concurrency cap: 64 concurrent script-executing jobs.
Sourcepub fn with_config(ns: Arc<Namespace>, config: &WorkflowConfig) -> Self
pub fn with_config(ns: Arc<Namespace>, config: &WorkflowConfig) -> Self
Create a WorkflowRunner honoring config’s max_concurrent_runs +
job_timeout_secs/step_timeout_secs (#521).
Sourcepub fn with_scheduler(self, scheduler: Arc<JobScheduler>) -> Self
pub fn with_scheduler(self, scheduler: Arc<JobScheduler>) -> Self
Attach a JobScheduler (#527): jobs whose runs_on: requests
isolation are placed onto its sandbox pool instead of running in-proc.
Sourcepub fn with_candidate_worktree(self, candidate: CandidateWorktree) -> Self
pub fn with_candidate_worktree(self, candidate: CandidateWorktree) -> Self
Bind a git2db-composed candidate worktree into each job namespace at
/src. The supplied host path is never exposed directly: every job gets
a distinct copy-up overlay and the bind is mediated as the job Subject.
Sourcepub async fn run(
&self,
workflow: &Workflow,
inputs: HashMap<String, String>,
subject: &Subject,
cancel: CancellationToken,
) -> Result<WorkflowRunResult, RunnerError>
pub async fn run( &self, workflow: &Workflow, inputs: HashMap<String, String>, subject: &Subject, cancel: CancellationToken, ) -> Result<WorkflowRunResult, RunnerError>
Run a complete workflow.
Jobs are topologically sorted by needs: into execution waves.
Independent jobs in each wave run concurrently. The cancel token
is checked between waves and propagated to individual jobs.
Bounded by run_semaphore (#521’s max_concurrent_runs): a run that
can’t get a permit waits here, honoring cancel while waiting.
Trait Implementations§
Source§impl Clone for WorkflowRunner
impl Clone for WorkflowRunner
Source§fn clone(&self) -> WorkflowRunner
fn clone(&self) -> WorkflowRunner
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for WorkflowRunner
impl !RefUnwindSafe for WorkflowRunner
impl Send for WorkflowRunner
impl Sync for WorkflowRunner
impl Unpin for WorkflowRunner
impl UnsafeUnpin for WorkflowRunner
impl !UnwindSafe for WorkflowRunner
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more