DagDef

class DagDef(val id: String)

A collection of tasks with directional dependencies.

Create a DagDef directly and register TaskDefs with addTask.

The Airflow.Dag annotation should generally be preferred in user code, where the annotation processor generates the wiring for you. Only use this class directly if you need to do low-level plumbing:

var dag = new DagDef("java_etl").config("schedule", "@daily");
var extract = dag.task("extract", Extract.class).config("retries", 2);
extract.before(dag.task("load", Load.class));

Dag and task IDs are validated authoritatively by the Airflow server. This class does not check the characters or length of a Dag or task ID. IDs the server would reject are reported as best-effort build-time warnings by the Gradle plugin's checkAirflowBundle task, which runs BundleInspector against the assembled Bundle.

Parameters

id

Dag identifier; must be unique within a Bundle.

See also

Constructors

Link copied to clipboard
constructor(id: String)

Properties

Link copied to clipboard
val id: String

Functions

Link copied to clipboard
fun addTask(task: TaskDef): DagDef

Registers a task with this Dag.

fun addTask(id: String, definition: Class<out Task>): DagDef

Registers a task from its ID and implementation class.

Link copied to clipboard
fun config(key: String, value: Any?): DagDef

Sets one Dag-level configuration value.

Link copied to clipboard
fun If(definition: Class<out ConditionTask>): ConditionRef

Declares a task whose boolean picks one of two tasks; the other is skipped.

fun If(id: String, definition: Class<out ConditionTask>): ConditionRef

Declares a task whose boolean picks one of two tasks, under the task ID id.

Link copied to clipboard
fun Switch(definition: Class<out SwitchTask>): SwitchRef

Declares a task that chooses one of several tasks to run; every other one is skipped.

fun Switch(id: String, definition: Class<out SwitchTask>): SwitchRef

Declares a task that chooses one of several tasks to run, under the task ID id.

Link copied to clipboard
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.

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

Declares a task that starts a run of another Dag.

Link copied to clipboard

Declares a task group of this Dag.