addTask

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

Registers a task from its ID and implementation class.

Return

This Dag, for chaining.

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 addTask(task: TaskDef): DagDef

Registers a task with this Dag.

A TaskDef belongs to at most one DagDef; registering the same instance with a second Dag, or twice with the same one, fails. Task IDs must be unique within a Dag. Tasks named as upstreams by Deps.Flow.before or Deps.Flow.after must be registered with the same Dag by the time it is added to a Bundle.

Return

This Dag, for chaining.

Parameters

task

Task definition to register.

Throws

if the task already belongs to a Dag or a task with the same ID is already registered.