pub struct Execution { /* private fields */ }Expand description
Runs moved forward in a database.
Implementations§
Source§impl Execution
impl Execution
Sourcepub fn set_wakes(&mut self, wakes: Wakes)
pub fn set_wakes(&mut self, wakes: Wakes)
Wakes a finished run’s DAG through wakes (a queued run may take its place).
Sourcepub fn set_metrics(&mut self, metrics: MasterMetrics)
pub fn set_metrics(&mut self, metrics: MasterMetrics)
Counts finished runs in metrics.
Sourcepub fn set_notifications(&mut self, notifications: Arc<Notifications>)
pub fn set_notifications(&mut self, notifications: Arc<Notifications>)
What finished runs and tasks notify ([notifications]).
Sourcepub const fn set_max_instances(&mut self, max_instances: usize)
pub const fn set_max_instances(&mut self, max_instances: usize)
The most instances a mapped task may have ([mapping] max_instances).
Sourcepub const fn set_rounds(&mut self, rounds: RoundLimits)
pub const fn set_rounds(&mut self, rounds: RoundLimits)
How much a round does at most (decision 493).
Sourcepub async fn late_cleanup_failed(
&self,
run_id: &str,
task: &str,
error: Option<String>,
now: Timestamp,
) -> Result<(), ExecutionError>
pub async fn late_cleanup_failed( &self, run_id: &str, task: &str, error: Option<String>, now: Timestamp, ) -> Result<(), ExecutionError>
Queues LATE_CLEANUP_FAILED for run run_id: a cleanup of task failed after the run
had succeeded (decision 309).
§Errors
ExecutionError for an unknown run or a database failure.
Sourcepub async fn prepare_runs(
&self,
now: Timestamp,
) -> Result<Vec<String>, ExecutionError>
pub async fn prepare_runs( &self, now: Timestamp, ) -> Result<Vec<String>, ExecutionError>
Creates the task instances of runs that started: empty tasks are completed, tasks with no upstream tasks are queued, mapped tasks with nothing to wait for expanded. Returns the runs prepared.
§Errors
ExecutionError::Db if the database fails.
Sourcepub async fn attempt_finished(
&self,
run_id: &str,
task_id: &TaskId,
map_index: i32,
result: &AttemptResult,
now: Timestamp,
) -> Result<Recorded, ExecutionError>
pub async fn attempt_finished( &self, run_id: &str, task_id: &TaskId, map_index: i32, result: &AttemptResult, now: Timestamp, ) -> Result<Recorded, ExecutionError>
Records how an attempt of a running task instance ended, moves the run forward and finishes it when every task has. A result for an instance that isn’t running is ignored (delivery is at least once).
§Errors
ExecutionError for an unknown run or task, or a database failure.
Sourcepub async fn attempts_finished(
&self,
run_id: &str,
results: &[(&TaskId, i32, &AttemptResult)],
now: Timestamp,
) -> Result<Recorded, ExecutionError>
pub async fn attempts_finished( &self, run_id: &str, results: &[(&TaskId, i32, &AttemptResult)], now: Timestamp, ) -> Result<Recorded, ExecutionError>
Records how several attempts of one run’s running instances ended, as
Self::attempt_finished does one, reading the run once and moving it forward once
(M4B.4, B184): their outputs stored in one statement, their instances and what follows
from them in one advance. state is the last result’s. A result for an instance that
isn’t running, or for one already given here, is ignored.
Results that arrived together are taken as if in the order that keeps each: a mapped instance’s success beside another’s failure of the same step stays a success (in turn, had the failure come first, it was cancelled, decision 75a); either order is what arrived.
§Errors
ExecutionError for an unknown run or task, or a database failure.
Sourcepub async fn cleaning_up(
&self,
run_id: &str,
task_id: &TaskId,
map_index: i32,
now: Timestamp,
) -> Result<(), ExecutionError>
pub async fn cleaning_up( &self, run_id: &str, task_id: &TaskId, map_index: i32, now: Timestamp, ) -> Result<(), ExecutionError>
A running instance’s task ended and its cleanup runs: its attempt stays open, and nothing downstream moves, until the attempt’s result.
§Errors
ExecutionError::Db if the database fails.
Sourcepub async fn queue_due_retries(
&self,
now: Timestamp,
) -> Result<usize, ExecutionError>
pub async fn queue_due_retries( &self, now: Timestamp, ) -> Result<usize, ExecutionError>
Queues the task instances whose retry delay has passed. Returns how many.
§Errors
ExecutionError::Db if the database fails.
Sourcepub async fn cancel_run(
&self,
run_id: &str,
now: Timestamp,
) -> Result<Cancelled, ExecutionError>
pub async fn cancel_run( &self, run_id: &str, now: Timestamp, ) -> Result<Cancelled, ExecutionError>
Cancels a run: a queued run ends cancelled at once; in a running one every task and
instance that hasn’t started is cancelled, and the running ones are returned to be
stopped (their results still count, and a failure among them isn’t retried).
§Errors
ExecutionError for an unknown run or a database failure.
Sourcepub async fn wind_down(
&self,
run_id: &str,
now: Timestamp,
) -> Result<Option<RunState>, ExecutionError>
pub async fn wind_down( &self, run_id: &str, now: Timestamp, ) -> Result<Option<RunState>, ExecutionError>
Winds down a run of a removed DAG (B192; archive/PROJECT.md, DAG code delivery: “attempts
already running finish; tasks not started yet are cancelled”): a queued run ends
cancelled; in a running one every task and instance not started is cancelled, as
Self::cancel_run does, but nothing running is stopped or marked. A resource’s
cleanup still runs. Returns the run’s result, if it finished now.
§Errors
ExecutionError for an unknown run or a database failure.
Sourcepub async fn cancel_task(
&self,
run_id: &str,
__arg2: (&TaskId, Option<i32>),
now: Timestamp,
) -> Result<TaskCancel, ExecutionError>
pub async fn cancel_task( &self, run_id: &str, __arg2: (&TaskId, Option<i32>), now: Timestamp, ) -> Result<TaskCancel, ExecutionError>
Cancels one task of a run: one that hasn’t started becomes cancelled at once, one
that runs is marked so that whatever its attempt reports (or a rejection, an expired
assignment, a lost worker) ends it cancelled without a retry, a failure staying a
failure. The tasks downstream of it are cancelled when it is. For a mapped task, every
instance of it.
§Errors
ExecutionError for an unknown run or task, or a database failure.
Sourcepub async fn retry_task(
&self,
run_id: &str,
__arg2: (&TaskId, Option<i32>),
now: Timestamp,
) -> Result<TaskRetry, ExecutionError>
pub async fn retry_task( &self, run_id: &str, __arg2: (&TaskId, Option<i32>), now: Timestamp, ) -> Result<TaskRetry, ExecutionError>
Queues an unschedulable task again (schedr tasks retry); for a mapped task, its
unschedulable instances.
§Errors
ExecutionError for an unknown run or task, or a database failure.
Sourcepub async fn fail_unschedulable(
&self,
run_id: &str,
__arg2: (&TaskId, i32),
reason: String,
now: Timestamp,
) -> Result<(Option<RunState>, Vec<(TaskId, i32)>), ExecutionError>
pub async fn fail_unschedulable( &self, run_id: &str, __arg2: (&TaskId, i32), reason: String, now: Timestamp, ) -> Result<(Option<RunState>, Vec<(TaskId, i32)>), ExecutionError>
Fails a resource’s user that waited too long for a worker, so the cleanup can run
(decision 273); nothing if it isn’t unschedulable any more. Returns the run’s result,
if it finished now, and the instances to stop (a mapped task’s others, its step failed).
§Errors
ExecutionError for an unknown run or a database failure.
Sourcepub async fn wait_ended(
&self,
run_id: &str,
task_id: &TaskId,
ended: WaitEnd,
now: Timestamp,
) -> Result<(Option<RunState>, Vec<(TaskId, i32)>), ExecutionError>
pub async fn wait_ended( &self, run_id: &str, task_id: &TaskId, ended: WaitEnd, now: Timestamp, ) -> Result<(Option<RunState>, Vec<(TaskId, i32)>), ExecutionError>
Ends a wait_for step (decision 353): with the other run’s ID; Failed where the DAG
routes it, or else the step fails (the user’s B); TimedOut. Nothing if it isn’t
queued any more. Returns the run’s result, if it finished now, and the instances to stop.
§Errors
ExecutionError for an unknown run or a database failure.
Sourcepub async fn settle(
&self,
run_id: &str,
now: Timestamp,
) -> Result<Option<RunState>, ExecutionError>
pub async fn settle( &self, run_id: &str, now: Timestamp, ) -> Result<Option<RunState>, ExecutionError>
Moves a run forward after a task’s state was changed directly (an assignment of a
task being cancelled taken back as cancelled). Returns the run’s result, if it
finished now.
§Errors
ExecutionError for an unknown run or a database failure.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Execution
impl !UnwindSafe for Execution
impl Freeze for Execution
impl Send for Execution
impl Sync for Execution
impl Unpin for Execution
impl UnsafeUnpin for Execution
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);