Skip to main content

Trigger

Enum Trigger 

Source
pub enum Trigger {
    None,
    Cron {
        expression: String,
        timezone: String,
        catchup: bool,
        start: Option<Timestamp>,
        end: Option<Timestamp>,
    },
    Every {
        interval_ms: u64,
        catchup: bool,
        start: Option<Timestamp>,
        end: Option<Timestamp>,
    },
    Once {
        at: Timestamp,
    },
    Event {
        task: Box<Task>,
        restart_if_idle_ms: Option<u64>,
        start: Option<Timestamp>,
        end: Option<Timestamp>,
        run_retries: Option<u32>,
    },
    RunOf {
        run_of: RunOf,
    },
    Chained {
        by: Option<Vec<DagId>>,
    },
    EventNamed {
        event: EventNamed,
    },
}
Expand description

What starts runs of a DAG besides people.

Variants§

§

None

Nothing: manual runs only (the DAG is switched off but for those).

§

Cron

A cron expression (5 or 6 fields, or a preset such as @daily) evaluated in a time zone.

Fields

§expression: String

The cron expression.

§timezone: String

An IANA time zone name, e.g. Europe/Warsaw; UTC by default in the Python API.

§catchup: bool

Whether missed fire times get runs in order (true) or only the most recent (false).

§start: Option<Timestamp>

The first run it creates is for the first fire time at or after it; without it, the moment the master first stored the DAG.

§end: Option<Timestamp>

The last run it creates is for the last fire time at or before it.

§

Every

A fixed interval measured in real time (UTC), unaffected by daylight saving.

Fields

§interval_ms: u64

The interval in milliseconds; fire times are whole intervals from start, or from the Unix epoch without one.

§catchup: bool

Whether missed fire times get runs in order (true) or only the most recent (false).

§start: Option<Timestamp>

The first run it creates is for the first fire time at or after it; without it, the moment the master first stored the DAG.

§end: Option<Timestamp>

The last run it creates is for the last fire time at or before it.

§

Once

A single fire time (it has no previous fire time).

Fields

§at: Timestamp

The fire time.

§

Event

A @trigger function, which runs in a worker’s watcher host and yields events: each new one starts a run.

Fields

§task: Box<Task>

Its function as a task of kind sensor: its literal arguments, whether it is called every so often, its queue, its secrets and connections. It isn’t in the graph.

§restart_if_idle_ms: Option<u64>

Started again from its bookmark when no event came for this long; None: never.

§start: Option<Timestamp>

It runs from this moment on.

§end: Option<Timestamp>

It stops at this moment.

§run_retries: Option<u32>

@trigger(wait_for=RunOf(...), run_retries=N) (decision 353): a run its function raised on is tried again this many times, then passed, recorded; None: tried until schedr triggers skip passes it.

§

RunOf

trigger=RunOf(...) (decision 353): a run per run of another DAG (or its task) that succeeded while this one is live, planned for that run’s planned_for plus lag, or for the moment the master saw it.

Fields

§run_of: RunOf

Which runs.

§

Chained

trigger=Chained() (decision 398): only other DAGs’ TriggerDagOperators start its runs (and people, by hand); the scheduler never does.

Fields

§by: Option<Vec<DagId>>

The DAGs whose operators may start it; None: any DAG. Never empty.

§

EventNamed

trigger=EventNamed(...) (decision 354): a run per event of that name posted through the API while this DAG is live, keyed by the event’s key, planned for its at.

Fields

§event: EventNamed

Which events: its name (a trigger takes no key).

Implementations§

Source§

impl Trigger

Source

pub const fn kind(&self) -> Option<&'static str>

Its kind as the UI names it and dag_triggers.kind stores it (decision 459): schedule (cron, every, once), run_of, chained or event (by a trigger or by name); None for no trigger. A change of kind pauses it; another trigger of the same kind keeps its switch.

Source

pub const fn is_manual_only(&self) -> bool

Whether the scheduler never creates runs: only people (or other DAGs) do.

Source

pub fn chained_from(&self, dag: &DagId) -> bool

Whether dag may start its runs with a TriggerDagOperator (decision 398): it is Chained, for any DAG or one of those it names.

Source

pub const fn is_run_of(&self) -> bool

Whether another DAG’s runs start its runs (trigger=RunOf(...)).

Source

pub const fn is_event(&self) -> bool

Whether events start its runs: it has no fire times.

Source

pub const fn brings_event(&self) -> bool

Whether its runs bring an event: a @trigger’s, or the run of another DAG that started it (RunOf).

Source

pub const fn catchup(&self) -> bool

Whether missed fire times get runs in order; false for triggers without catchup (a single fire time has nothing to catch up on).

Source

pub const fn start(&self) -> Option<Timestamp>

Where the runs it creates start (see the start fields); None for triggers without one.

Source

pub const fn end(&self) -> Option<Timestamp>

Where the runs it creates end (see the end fields); None for triggers without one.

Trait Implementations§

Source§

impl Clone for Trigger

Source§

fn clone(&self) -> Trigger

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Trigger

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Trigger

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for Trigger

Source§

impl JsonSchema for Trigger

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl PartialEq for Trigger

Source§

fn eq(&self, other: &Trigger) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Trigger

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Trigger

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.