pub struct RunProgress<'a> { /* private fields */ }Expand description
A run’s task states, moved forward by the DAG’s structure.
Implementations§
Source§impl<'a> RunProgress<'a>
impl<'a> RunProgress<'a>
Sourcepub fn new(dag: &'a Dag, states: BTreeMap<TaskId, TaskInstanceState>) -> Self
pub fn new(dag: &'a Dag, states: BTreeMap<TaskId, TaskInstanceState>) -> Self
The progress of a run of dag with the given task states (tasks not given are
scheduled).
Sourcepub fn with_instances(self, instances: BTreeMap<TaskId, Instances>) -> Self
pub fn with_instances(self, instances: BTreeMap<TaskId, Instances>) -> Self
The same, with the instances of mapped tasks that expanded.
Sourcepub fn instances(&self, task: &TaskId) -> Option<&Instances>
pub fn instances(&self, task: &TaskId) -> Option<&Instances>
A mapped task’s instances, once it expanded.
Sourcepub fn set_instance(
&mut self,
task: &TaskId,
index: usize,
state: TaskInstanceState,
)
pub fn set_instance( &mut self, task: &TaskId, index: usize, state: TaskInstanceState, )
Sets an instance’s state (after one of its attempts).
Sourcepub fn set_instance_outcome(
&mut self,
task: &TaskId,
index: usize,
outcome: &str,
)
pub fn set_instance_outcome( &mut self, task: &TaskId, index: usize, outcome: &str, )
Records an instance’s outcome (after an attempt that succeeded).
Sourcepub fn take_expansions(&mut self) -> Vec<TaskId>
pub fn take_expansions(&mut self) -> Vec<TaskId>
The mapped tasks ready to expand, taken (each comes back from Self::settle until
expanded).
Sourcepub fn expand(&mut self, task: &TaskId, expansion: Expansion)
pub fn expand(&mut self, task: &TaskId, expansion: Expansion)
Expands a mapped task as the master resolved it: its instances scheduled (none: a
success with []), or failed with a reason.
Sourcepub fn reason(&self, task: &TaskId) -> Option<&str>
pub fn reason(&self, task: &TaskId) -> Option<&str>
Why a mapped task failed without an attempt, if it did.
Sourcepub fn take_stops(&mut self) -> Vec<(TaskId, usize)>
pub fn take_stops(&mut self) -> Vec<(TaskId, usize)>
Running instances to stop, taken: their step failed (decision 75a).
Sourcepub fn changes_since(&self, before: &Snapshot) -> Changes
pub fn changes_since(&self, before: &Snapshot) -> Changes
What changed since before: rows to update, and instances an expansion created.
Sourcepub fn with_chosen(self, chosen: BTreeMap<TaskId, Vec<TaskId>>) -> Self
pub fn with_chosen(self, chosen: BTreeMap<TaskId, Vec<TaskId>>) -> Self
The same, with what the @branch tasks that succeeded chose.
Sourcepub fn with_outcomes(self, outcomes: BTreeMap<TaskId, String>) -> Self
pub fn with_outcomes(self, outcomes: BTreeMap<TaskId, String>) -> Self
The same, with the outcomes of the tasks that succeeded.
Sourcepub fn outcome(&self, task: &TaskId) -> Option<&str>
pub fn outcome(&self, task: &TaskId) -> Option<&str>
A task’s outcome, if it succeeded with one recorded.
Sourcepub fn set_outcome(&mut self, task: &TaskId, outcome: &str)
pub fn set_outcome(&mut self, task: &TaskId, outcome: &str)
Records a task’s outcome (after an attempt that succeeded).
Sourcepub const fn states(&self) -> &BTreeMap<TaskId, TaskInstanceState>
pub const fn states(&self) -> &BTreeMap<TaskId, TaskInstanceState>
Every task’s state.
Sourcepub fn set(&mut self, task: &TaskId, state: TaskInstanceState)
pub fn set(&mut self, task: &TaskId, state: TaskInstanceState)
Sets a task’s state (after an attempt, or a retry delay that passed).
Sourcepub fn settle(&mut self) -> Vec<(TaskId, TaskInstanceState)>
pub fn settle(&mut self) -> Vec<(TaskId, TaskInstanceState)>
Moves scheduled tasks on as far as their upstream tasks allow: ready tasks become
queued (empty tasks success, completed by the master), others skipped,
upstream_failed or cancelled; mapped tasks ready to expand are listed for
Self::take_expansions, and expanded ones move their instances on; repeated until
nothing changes, or until a first_of ends (Self::take_winners: its output is
made before what follows it moves). Returns the tasks (as a whole) whose state changed,
with their new state, in the order they changed.
Sourcepub fn fail_first_of(&mut self, task: &TaskId, reason: String)
pub fn fail_first_of(&mut self, task: &TaskId, reason: String)
A first_of whose output can’t be kept fails, with why.
Sourcepub fn take_winners(&mut self) -> BTreeMap<TaskId, Vec<TaskId>>
pub fn take_winners(&mut self) -> BTreeMap<TaskId, Vec<TaskId>>
The first_of tasks ended since this was last asked, each with what can have ended it.
Sourcepub fn cancel(&mut self) -> (Vec<(TaskId, TaskInstanceState)>, Vec<InstanceKey>)
pub fn cancel(&mut self) -> (Vec<(TaskId, TaskInstanceState)>, Vec<InstanceKey>)
Cancels the run: every task (and instance) that hasn’t started becomes cancelled.
Returns the tasks’ changes, and the tasks and instances still running, by map_index
(their attempts are to be cancelled; they finish on their own and their results
count). A mapped task as a whole ends once its instances have (Self::settle).
Sourcepub fn result(&self) -> Option<RunState>
pub fn result(&self) -> Option<RunState>
The run’s result, once every task and instance has finished.
Sourcepub const fn with_cancelling(self, cancelling: bool) -> Self
pub const fn with_cancelling(self, cancelling: bool) -> Self
Notes that the run is being cancelled: it can’t end success.
Sourcepub const fn with_failed_cleanup(self, failed: bool) -> Self
pub const fn with_failed_cleanup(self, failed: bool) -> Self
Notes that a cleanup failed: the run ends failed (see archive/PROJECT.md, Run result).
Trait Implementations§
Source§impl<'a> Clone for RunProgress<'a>
impl<'a> Clone for RunProgress<'a>
Source§fn clone(&self) -> RunProgress<'a>
fn clone(&self) -> RunProgress<'a>
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<'a> Freeze for RunProgress<'a>
impl<'a> RefUnwindSafe for RunProgress<'a>
impl<'a> Send for RunProgress<'a>
impl<'a> Sync for RunProgress<'a>
impl<'a> Unpin for RunProgress<'a>
impl<'a> UnsafeUnpin for RunProgress<'a>
impl<'a> UnwindSafe for RunProgress<'a>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute] value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi [Quirk] value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);