task

fun <T> task(id: String, definition: Class<out Task>): TaskRef<T>

Creates a task, registers it, and hands back its handle, ready to carry configuration and to wire edges with Deps.Flow.before.

var extract = dag.task("extract", Extract.class).config("retries", 2);
var load = dag.task("load", Load.class);
extract.before(load);

Return

The handle representing this task.

Parameters

id

Task identifier, unique within this Dag.

definition

Class that implements Task. Must have a public no-arg constructor.

Throws

if a task with the same ID is already registered.


fun task(id: String, trigger: TriggerDagRun): TaskRef<Void>

Declares a task that starts a run of another Dag.

dag.task("trigger_downstream", new TriggerDagRun("downstream_etl"));

The task runs no Java code and takes no arguments, so it has no ID to derive and names one here.

Return

The handle representing this task.

Parameters

id

Task identifier, unique within this Dag.

trigger

What to trigger, and how.

Throws

if a task with the same ID is already registered.