Skip to main content

TaskKind

Enum TaskKind 

Source
pub enum TaskKind {
    Python {
        arguments: BTreeMap<String, Value>,
        branch: bool,
    },
    Sensor {
        arguments: BTreeMap<String, Value>,
        mode: SensorMode,
        every_ms: Option<u64>,
        max_wait_ms: Option<u64>,
        wait_for: Option<SensorWaitFor>,
        batch_ms: Option<u64>,
    },
    FirstOf {
        at_least: Option<u32>,
    },
    WaitFor {
        run_of: RunOf,
        max_wait_ms: Option<u64>,
    },
    WaitForEvent {
        event: EventNamed,
        max_wait_ms: Option<u64>,
    },
    TriggerDag {
        dag: DagId,
        params: BTreeMap<String, Value>,
        planned_for: Option<Value>,
        wait: bool,
        max_wait_ms: Option<u64>,
    },
    Command {
        command: CommandLine,
        env: BTreeMap<String, Template>,
        connection_env: BTreeMap<String, String>,
        resource: Option<ResourceRole>,
    },
    Script {
        job: String,
        script: String,
        interpreter: String,
        args: Vec<Template>,
        env: BTreeMap<String, Template>,
        working_dir: String,
        resource: Option<ResourceRole>,
    },
    Empty,
}
Expand description

The kind of a task and what it runs.

Variants§

§

Python

A @task function, found by task ID when the runner imports the DAG file.

Fields

§arguments: BTreeMap<String, Value>

The arguments by parameter name.

§branch: bool

A @branch task: its output is the list of the downstream task IDs it chose, and its outgoing edges are selection edges.

§

Sensor

A wait step (@sensor, @sensor.poke): found by task ID, as a Python task, and ending with its value or with the TimedOut outcome.

Fields

§arguments: BTreeMap<String, Value>

The arguments by parameter name.

§mode: SensorMode

How it waits.

§every_ms: Option<u64>

How often to call it (Poke), in milliseconds.

§max_wait_ms: Option<u64>

How long it waits, in milliseconds; None: the worker’s [sensors] default_max_wait.

§wait_for: Option<SensorWaitFor>

@sensor(wait_for=RunOf(...)) (decision 353): called once a matching run of another DAG has ended, with it as param, rather than at once.

§batch_ms: Option<u64>

@trigger.poke(every=..., batch=...) (decision 352): what its pokes return is gathered for this many milliseconds from the first item, then sent as one event.

§

FirstOf

first_of / at_least (decision 347): ended by the master, no process and no slot, as soon as enough of its upstream edges are taken. Its output is {"$value": ..., "winner": ...}: the winner’s output and ID, or for at_least lists of them in the order they ended.

Fields

§at_least: Option<u32>

at_least’s count; None: first_of, ending with one edge.

§

WaitFor

wait_for(RunOf(...)) (decision 353): waits for a run of another DAG, or one of its tasks, ended by the master with no process and no slot. Its value is that run’s ID; it ends Failed when the run (or task) ended otherwise, and TimedOut after max_wait.

Fields

§run_of: RunOf

Which run.

§max_wait_ms: Option<u64>

How long it waits, in milliseconds; None: the master’s [sensors] default_max_wait.

§

WaitForEvent

wait_for(EventNamed(...)) (decision 354): waits for an event posted through the API, ended by the master with no process and no slot. Its value is the event (key, data, at); TimedOut after max_wait.

Fields

§event: EventNamed

Which event.

§max_wait_ms: Option<u64>

How long it waits, in milliseconds; None: the master’s [sensors] default_max_wait.

§

TriggerDag

TriggerDagOperator (decisions 357-362, 365, 378-381): starts a chained run of another DAG, carried out by the master with no process and no slot. Its value is the started run’s ID; with wait it ends when that run has: Failed when the run didn’t succeed, TimedOut after max_wait.

Fields

§dag: DagId

The DAG to start a run of.

§params: BTreeMap<String, Value>

The run’s parameters, over the target’s defaults: literals or references, resolved by the master and checked against the target’s schema when the task runs.

§planned_for: Option<Value>

The run’s planned_for, a datetime or a reference; None: the parent run’s.

§wait: bool

Whether it waits for the run to end (the default) or ends once the run is created.

§max_wait_ms: Option<u64>

How long it waits, in milliseconds; None: the master’s [sensors] default_max_wait.

§

Command

An inline command, run by the agent.

Fields

§command: CommandLine

The command line.

§env: BTreeMap<String, Template>

Extra environment variables for the process.

§connection_env: BTreeMap<String, String>

Connections given as variables and files (decision 184: connections={"DB": warehouse}), by prefix: DB_URL, DB_PGPASSFILE, … Each is also in the task’s connections.

§resource: Option<ResourceRole>

Its part in a resource (M4.8d): a CommandResource’s setup, or a resource’s cleanup_command; None for any other command.

§

Script

A script declared in a schedr.toml (M4.9): run by the agent with the declared interpreter, from its script root at the version the master expects. A standalone job’s task.

Fields

§job: String

The declaration: <root>:<schedr.toml's path in the root>#<name>.

§script: String

The script, relative to the script root.

§interpreter: String

The interpreter: an [interpreters] entry of the worker that runs it.

§args: Vec<Template>

Its arguments, each one argument (never a shell string).

§env: BTreeMap<String, Template>

Extra environment variables for the process.

§working_dir: String

Where it runs, relative to the script root (schedr.toml’s directory by default).

§resource: Option<ResourceRole>

Its part in a resource (ScriptResource, cleanup_script), if any.

§

Empty

An EmptyOperator: completed by the master, no process.

Trait Implementations§

Source§

impl Clone for TaskKind

Source§

fn clone(&self) -> TaskKind

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 TaskKind

Source§

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

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

impl<'de> Deserialize<'de> for TaskKind

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 TaskKind

Source§

impl JsonSchema for TaskKind

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 TaskKind

Source§

fn eq(&self, other: &TaskKind) -> 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 TaskKind

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 TaskKind

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.