pub struct Scheduler { /* private fields */ }Expand description
The scheduler over a database (cheap to clone; clones share which DAGs are quiet).
Implementations§
Source§impl Scheduler
impl Scheduler
Sourcepub async fn backfill(
&self,
id: &str,
dag_id: &DagId,
ask: BackfillAsk<'_>,
__arg4: (&str, u32),
now: Timestamp,
) -> Result<BackfillCount, SchedulerError>
pub async fn backfill( &self, id: &str, dag_id: &DagId, ask: BackfillAsk<'_>, __arg4: (&str, u32), now: Timestamp, ) -> Result<BackfillCount, SchedulerError>
Creates a backfill of dag_id as ask says, with the ID id (a command’s: a command
applied again finds it stored), its runs by user, its range of at most max_runs fire
times.
§Errors
SchedulerError::NotRunnable or SchedulerError::Held as for a manual run;
SchedulerError::Backfill for a DAG without fire times, a range with none or more
than max_runs fire times, a range ending before it starts; SchedulerError::Params
for parameters refused; what storing it fails with.
Source§impl Scheduler
impl Scheduler
Sourcepub fn new(db: Database) -> Self
pub fn new(db: Database) -> Self
A scheduler storing runs in db, with the default quiet DAG settings.
Sourcepub fn with_quiet(db: Database, settings: QuietSettings, wakes: Wakes) -> Self
pub fn with_quiet(db: Database, settings: QuietSettings, wakes: Wakes) -> Self
A scheduler storing runs in db, skipping quiet DAGs as settings say, woken by
wakes (shared with what changes runs).
Sourcepub fn with_limits(self, rounds: &RoundLimits, for_tolerance: Duration) -> Self
pub fn with_limits(self, rounds: &RoundLimits, for_tolerance: Duration) -> Self
The scheduler with the master’s bounds (decision 493).
Sourcepub fn set_metrics(&self, metrics: MasterMetrics)
pub fn set_metrics(&self, metrics: MasterMetrics)
Counts busy and quiet DAGs, and wakes, in metrics.
Sourcepub async fn pass(&self, now: Timestamp) -> Result<Pass, SchedulerError>
pub async fn pass(&self, now: Timestamp) -> Result<Pass, SchedulerError>
One pass at now over the DAGs that can run: every one, or the busy ones and the
quiet ones woken.
§Errors
SchedulerError::Db if the database fails (the pass stops; what was stored stays).
Sourcepub async fn trigger(
&self,
dag_id: &DagId,
requested: Option<Timestamp>,
user: &str,
now: Timestamp,
) -> Result<CreatedRun, SchedulerError>
pub async fn trigger( &self, dag_id: &DagId, requested: Option<Timestamp>, user: &str, now: Timestamp, ) -> Result<CreatedRun, SchedulerError>
Creates a manual run for requested (--for) or now, by user; it starts at once
if the DAG has a free place, and waits as queued otherwise. A paused DAG’s manual
runs run normally.
§Errors
SchedulerError::NotRunnable, SchedulerError::Held while its file fails to
import, SchedulerError::ManualRun for a time in the future,
SchedulerError::FireTimes or SchedulerError::Db.
Sourcepub async fn trigger_as(
&self,
run_id: Option<&str>,
dag_id: &DagId,
requested: Option<Timestamp>,
__arg4: (Option<&Map<String, Value>>, Option<&RunEvent>),
user: &str,
now: Timestamp,
) -> Result<CreatedRun, SchedulerError>
pub async fn trigger_as( &self, run_id: Option<&str>, dag_id: &DagId, requested: Option<Timestamp>, __arg4: (Option<&Map<String, Value>>, Option<&RunEvent>), user: &str, now: Timestamp, ) -> Result<CreatedRun, SchedulerError>
As Self::trigger, the run’s ID given (trigger_run passes its command’s): a run
with that ID already there (the command applied before its decision was stored) is
the one returned, not created again (B7). params: the values given for the run’s
parameters, over the DAG’s defaults.
§Errors
As Self::trigger, and SchedulerError::Params for parameters refused.
Sourcepub async fn trigger_chained(
&self,
run_id: &str,
dag_id: &DagId,
planned_for: Timestamp,
params: Option<&Map<String, Value>>,
__arg5: (&str, &DagId),
now: Timestamp,
) -> Result<CreatedRun, SchedulerError>
pub async fn trigger_chained( &self, run_id: &str, dag_id: &DagId, planned_for: Timestamp, params: Option<&Map<String, Value>>, __arg5: (&str, &DagId), now: Timestamp, ) -> Result<CreatedRun, SchedulerError>
Creates a chained run of dag_id (a TriggerDagOperator’s, decisions 357-362): as a
manual run, with its ID given, parent_run_id as its parent and triggered_by, if the
DAG is trigger=Chained() letting parent_dag start it, and not paused (decision 398).
§Errors
As Self::trigger_as.
Sourcepub async fn event_run(
&self,
active: &ActiveDag,
event: &RunEvent,
since: Option<Timestamp>,
now: Timestamp,
) -> Result<Option<String>, SchedulerError>
pub async fn event_run( &self, active: &ActiveDag, event: &RunEvent, since: Option<Timestamp>, now: Timestamp, ) -> Result<Option<String>, SchedulerError>
Stores what a DAG’s trigger found: a key not seen before queues a run, as a manual one
(since is the previous event’s planned_for), a repeat moves the bookmark only. Gives
the run’s ID, None for a repeat.
§Errors
SchedulerError::Params for parameters refused, and what storing it fails with.
Sourcepub async fn batch_run(
&self,
active: &ActiveDag,
batch: &RunEvent,
items: &[(RunEvent, Value)],
since: Option<Timestamp>,
now: Timestamp,
) -> Result<Option<String>, SchedulerError>
pub async fn batch_run( &self, active: &ActiveDag, batch: &RunEvent, items: &[(RunEvent, Value)], since: Option<Timestamp>, now: Timestamp, ) -> Result<Option<String>, SchedulerError>
Stores a batch a trigger found (decision 352): each item an event, a run for the new ones
only (B188), as Self::event_run does for one. Gives the run’s ID, None when every
item was seen before.
§Errors
As Self::event_run.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Scheduler
impl !UnwindSafe for Scheduler
impl Freeze for Scheduler
impl Send for Scheduler
impl Sync for Scheduler
impl Unpin for Scheduler
impl UnsafeUnpin for Scheduler
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);