Label

Source: dag.ts:365

A text label for an edge. The Airflow UI shows the label on the edge in the graph, as it does for Python's Label. The text comes before the task that the label is put on. That way the text sits between the two tasks of the edge in the code, just as the label sits between them in the graph:

CODE
// load >> Label("when empty") >> report_empty
loaded.before(Label.of("when empty").on(reportedEmpty));
// load >> Label("always") >> cleanup
cleaned.after(Label.of("always").on(loaded));

Constructors

new Label(): Label

Returns

Label


Methods

on(node: Node, ...more: readonly Node[]): Node

Put the label on each edge that a before or after call draws between its receiver and node or a node in more.

So each edge of a fan-out can have its own label, and one label can go on several edges:

CODE
checked.before(Label.of("rows found").on(processed), Label.of("no rows").on(reportedEmpty));
// load >> Label("forks") >> [report_empty, notify]
loaded.before(Label.of("forks").on(reportedEmpty, notified));

Pass the value that on returns to before or after. Calling before or after on that value throws an error.

Parameters

  • node (Node)
  • more (readonly Node[])

Returns

  • Node

Static Methods

of(text: string): Label

Make a label with the given text. Use on to put the label on edges. text must not be empty or only whitespace.

Parameters

  • text (string)

Returns