pub struct Step {Show 21 fields
pub name: String,
pub dir: PathBuf,
pub action: Action,
pub deps: Vec<String>,
pub reads: Vec<Artefact>,
pub params: Vec<String>,
pub inputs: Vec<Input>,
pub prechecks: Vec<Precheck>,
pub services: Vec<Service>,
pub outputs: Vec<Output>,
pub timeout: Option<Duration>,
pub complete_on: ExitCodes,
pub pass_patterns: Vec<Pattern>,
pub fail_patterns: Vec<Pattern>,
pub fail_on_exit: Option<String>,
pub judge: Option<Arc<dyn Fn(&Judging<'_>) -> Outcome + Send + Sync>>,
pub parse: Option<Parse>,
pub run_after_fail: bool,
pub volatile: bool,
pub holds: BTreeMap<String, u64>,
pub shares_dir: bool,
}Fields§
§name: String§dir: PathBufThe step’s own working directory. It is emptied before the step runs.
action: Action§deps: Vec<String>Steps that must pass first. Their outputs are part of the cache key. Reading another step’s artefact adds the step here, so a flow names a dependency once.
reads: Vec<Artefact>The artefacts of other steps that it reads.
params: Vec<String>What an in-process function was made from, such as an option it captured. A function can’t be hashed, so what changes its result is said here, and is part of the cache key.
inputs: Vec<Input>§prechecks: Vec<Precheck>Conditions checked before any step of the run starts, on top of those its invocations declare.
services: Vec<Service>§outputs: Vec<Output>§timeout: Option<Duration>§complete_on: ExitCodes§pass_patterns: Vec<Pattern>Each must match in its output, or the tool did not finish normally: a step error.
fail_patterns: Vec<Pattern>A match of any in its output fails the step.
fail_on_exit: Option<String>A step that completed with an exit code other than 0 fails, with
this message: {code} in it is the code. It is data, so unlike a
judge it is part of the cache key, for a tool whose exit code is
its verdict.
judge: Option<Arc<dyn Fn(&Judging<'_>) -> Outcome + Send + Sync>>§parse: Option<Parse>What reads the step’s results from what it wrote, once it completed: its judge is given them, and the flow reads them from the output.
run_after_fail: boolRun even if a step it depends on failed, as a report of failures does. It is still skipped after a step that did not complete.
volatile: boolThe result can’t be repeated, so it must never be cached.
holds: BTreeMap<String, u64>What the step holds from the resource pools on top of what its invocations declare, such as memory. A flow’s config sets it, since how much a step needs depends on the design.
A child of a cache unit that works in the unit’s own directory,
beside its siblings. It is not emptied before it runs, and its
command’s logs are named after it. Step::unit sets it.
Implementations§
Source§impl Step
impl Step
fn new(name: &str, dir: PathBuf, action: Action) -> Self
pub fn exec(name: &str, dir: PathBuf, inv: Invocation) -> Self
Sourcepub fn unit(name: &str, dir: PathBuf, children: Vec<Step>) -> Self
pub fn unit(name: &str, dir: PathBuf, children: Vec<Step>) -> Self
A cache unit: a step with child steps and no command of its own.
The children’s directories are in dir, and each runs once those it
depends on are done, beside any others that fit in what the unit
holds. A child only completes or not: the unit has the verdict, from
what it exports. No flow has one yet.
Sourcepub fn group(name: &str, dir: PathBuf, children: Vec<Step>) -> Self
pub fn group(name: &str, dir: PathBuf, children: Vec<Step>) -> Self
A composite step: child steps grouped under one name, each cached
by itself. The children’s directories are in dir. No flow has one
yet.
Sourcepub fn export(self, artefact: &Artefact) -> Self
pub fn export(self, artefact: &Artefact) -> Self
Export a child’s artefact from a cache unit or a composite step: an
output of the parent, named CHILD.OUTPUT, which other steps read.
A unit’s exports are what the cache stores of it.
Sourcepub fn with_action(name: &str, dir: PathBuf, action: Action) -> Self
pub fn with_action(name: &str, dir: PathBuf, action: Action) -> Self
A step that does action, for a tool that gives either kind.
Sourcepub fn after(self, dep: &str) -> Self
pub fn after(self, dep: &str) -> Self
Run after dep without reading anything of it. A step that reads
an artefact says so with Step::reads, and no flow needs this.
Sourcepub fn parsed(
self,
name: &str,
path: impl Into<PathBuf>,
parse: Arc<dyn Fn(&Path) -> Result<Value> + Send + Sync>,
) -> Self
pub fn parsed( self, name: &str, path: impl Into<PathBuf>, parse: Arc<dyn Fn(&Path) -> Result<Value> + Send + Sync>, ) -> Self
Parse what the step wrote, once it completed, into path, the
output name. Its judge is given the results.
pub fn input(self, name: &str, path: impl Into<PathBuf>) -> Self
pub fn output(self, name: &str, path: impl Into<PathBuf>) -> Self
Sourcepub fn debug_output(self, name: &str, path: impl Into<PathBuf>) -> Self
pub fn debug_output(self, name: &str, path: impl Into<PathBuf>) -> Self
Declare an output that is only kept and cached in a run with
--debug. See Output::debug.
Sourcepub fn artefact(&self, name: &str) -> Artefact
pub fn artefact(&self, name: &str) -> Artefact
The step’s output name, for another step to read. Panics if the
step declares no such output: a flow names its own steps’ outputs.
Sourcepub fn reads(self, artefact: &Artefact) -> Self
pub fn reads(self, artefact: &Artefact) -> Self
Read an artefact of another step, which this step then runs after.
pub fn precheck(self, check: Precheck) -> Self
Sourcepub fn param(self, what: &str, value: impl Debug) -> Self
pub fn param(self, what: &str, value: impl Debug) -> Self
Key the step on something its in-process function captured. See
Step::params.
Sourcepub fn pattern_source(&self, output: &str) -> Option<PathBuf>
pub fn pattern_source(&self, output: &str) -> Option<PathBuf>
The file a pattern’s output names: a declared output, or the
command’s stdout or stderr.
Sourcepub fn service(self, s: Service) -> Self
pub fn service(self, s: Service) -> Self
Add a service. Its inputs and outputs become the step’s, named
SERVICE.NAME: they are keyed, checked and cached as the step’s are,
and an output is checked once the service has stopped, with the
step’s own.
Sourcepub fn hold(self, pool: &str, amount: u64) -> Self
pub fn hold(self, pool: &str, amount: u64) -> Self
Hold amount of the resource pool pool while the step runs, on
top of what its invocations declare, such as memory a flow knows the
step needs. A flow’s config can still change it.
No flow uses this yet: their memory and disk come from config.
Sourcepub fn stdout(&self) -> PathBuf
pub fn stdout(&self) -> PathBuf
Where the command’s standard output goes: stdout.log in the
step’s directory, or CHILD.stdout.log for a child that shares its
unit’s.
pub fn stderr(&self) -> PathBuf
fn log(&self, name: &str) -> PathBuf
Sourcepub fn leaves(&self) -> Vec<&Step>
pub fn leaves(&self) -> Vec<&Step>
The steps that run a command or a function: the step itself, or the leaves under a cache unit or a composite step.
Sourcepub fn parts(&self) -> Vec<(Option<&str>, &Invocation)>
pub fn parts(&self) -> Vec<(Option<&str>, &Invocation)>
The parts of a step that runs a command, as resources are given and measured: its command, then each service, by name. None for a step that runs no command of its own.
Sourcepub fn invocations(&self) -> impl Iterator<Item = &Invocation>
pub fn invocations(&self) -> impl Iterator<Item = &Invocation>
Every invocation the step itself runs: its command, then its services. A cache unit runs none: its children do.
Sourcepub fn resources(&self, all_threads: u64) -> BTreeMap<String, u64>
pub fn resources(&self, all_threads: u64) -> BTreeMap<String, u64>
What the step holds from each resource pool while it runs: the sum
over its command and services, which all run at once, and what the
step itself declares. all_threads is as many threads as a step can
have. A step that runs in-process holds one thread.
Auto Trait Implementations§
impl !RefUnwindSafe for Step
impl !UnwindSafe for Step
impl Freeze for Step
impl Send for Step
impl Sync for Step
impl Unpin for Step
impl UnsafeUnpin for Step
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> 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