pub struct Plan<'a> {
pub dag: &'a Dag,
pub fire_times: &'a FireTimes,
pub first_seen: Timestamp,
pub limits: PlanLimits,
}Expand description
A DAG’s time trigger with what its rules need.
Fields§
§dag: &'a DagThe DAG.
fire_times: &'a FireTimesIts fire times.
first_seen: TimestampWhen the master first stored it (its start, without start).
limits: PlanLimitsHow much it may create at once, and how far ahead a --for may be.
Implementations§
Source§impl Plan<'_>
impl Plan<'_>
Sourcepub fn effective_start(&self) -> Timestamp
pub fn effective_start(&self) -> Timestamp
The moment scheduled runs start from: start, or when the DAG was first stored.
Sourcepub fn next_fire_after(&self, now: Timestamp) -> Option<Timestamp>
pub fn next_fire_after(&self, now: Timestamp) -> Option<Timestamp>
The DAG’s next fire time after now (from its start, if that is later), within its
end; None when it has no more.
Sourcepub fn fire_time_since(&self, planned_for: Timestamp) -> Timestamp
pub fn fire_time_since(&self, planned_for: Timestamp) -> Timestamp
The window of a run on a fire time: one schedule period.
Sourcepub fn fire_time_sinces(&self, times: &[Timestamp]) -> Vec<Timestamp>
pub fn fire_time_sinces(&self, times: &[Timestamp]) -> Vec<Timestamp>
Self::fire_time_since of each of times, consecutive fire times oldest first (a
backfill’s range): each window starts at the fire time before it, so the range costs
one lookup, not one per fire time, which near a daylight-saving change walks hours of a
sub-minute cron’s matches each (B199).
Sourcepub fn manual_times(
&self,
requested: Option<Timestamp>,
now: Timestamp,
nearest_earlier: Option<Timestamp>,
) -> Result<RunTimes, ManualRunError>
pub fn manual_times( &self, requested: Option<Timestamp>, now: Timestamp, nearest_earlier: Option<Timestamp>, ) -> Result<RunTimes, ManualRunError>
The times of a manual run: for requested (--for) or now. On a fire time it gets
one schedule period; otherwise it covers what happened since nearest_earlier (the
planned_for of the nearest earlier run of any kind, before manual_planned_for),
else since initial_since, else since the previous fire time; with none of these its
window is empty.
§Errors
ManualRunError::InFuture if requested is after now (beyond its for_tolerance).
Sourcepub fn scheduled_runs(
&self,
last_scheduled: Option<Timestamp>,
running: u32,
now: Timestamp,
) -> Vec<RunTimes>
pub fn scheduled_runs( &self, last_scheduled: Option<Timestamp>, running: u32, now: Timestamp, ) -> Vec<RunTimes>
The scheduled runs to create at now, given the latest planned_for of the DAG’s
scheduled runs and how many of its runs are running. A paused DAG creates none (its
fire times are missed); the caller checks that.
Sourcepub fn scheduled_runs_except(
&self,
last_scheduled: Option<Timestamp>,
running: u32,
now: Timestamp,
covered: &BTreeSet<Timestamp>,
) -> Vec<RunTimes>
pub fn scheduled_runs_except( &self, last_scheduled: Option<Timestamp>, running: u32, now: Timestamp, covered: &BTreeSet<Timestamp>, ) -> Vec<RunTimes>
As Self::scheduled_runs, leaving out the fire times in covered: those with a
successful, queued or running run of another kind (a backfill’s, a manual one), which
get no scheduled run and take no place. With catchup the ones after them follow.
Sourcepub fn first_waiting(
&self,
last_scheduled: Option<Timestamp>,
now: Timestamp,
covered: &BTreeSet<Timestamp>,
) -> Option<Timestamp>
pub fn first_waiting( &self, last_scheduled: Option<Timestamp>, now: Timestamp, covered: &BTreeSet<Timestamp>, ) -> Option<Timestamp>
The first fire time still due at now after last_scheduled, whatever the places
free, leaving out covered (decision 485: the scheduler visits the DAG again while
one waits).
Sourcepub fn free_places(&self, running: u32) -> usize
pub fn free_places(&self, running: u32) -> usize
How many more runs may run (usize::MAX without a limit).
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Plan<'a>
impl<'a> RefUnwindSafe for Plan<'a>
impl<'a> Send for Plan<'a>
impl<'a> Sync for Plan<'a>
impl<'a> Unpin for Plan<'a>
impl<'a> UnsafeUnpin for Plan<'a>
impl<'a> UnwindSafe for Plan<'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);