You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/apache-airflow/authoring-and-scheduling/dynamic-task-mapping.rst
+6-4
Original file line number
Diff line number
Diff line change
@@ -84,10 +84,6 @@ The grid view also provides visibility into your mapped tasks in the details pan
84
84
85
85
Although we show a "reduce" task here (``sum_it``) you don't have to have one, the mapped tasks will still be executed even if they have no downstream tasks.
86
86
87
-
.. warning:: ``TriggerRule.ALWAYS`` cannot be utilized in expanded tasks
88
-
89
-
Assigning ``trigger_rule=TriggerRule.ALWAYS`` in expanded tasks is forbidden, as expanded parameters will be undefined with the task's immediate execution.
90
-
This is enforced at the time of the DAG parsing, and will raise an error if you try to use it.
91
87
92
88
Task-generated Mapping
93
89
----------------------
@@ -113,6 +109,12 @@ The above examples we've shown could all be achieved with a ``for`` loop in the
113
109
114
110
The ``make_list`` task runs as a normal task and must return a list or dict (see `What data types can be expanded?`_), and then the ``consumer`` task will be called four times, once with each value in the return of ``make_list``.
115
111
112
+
.. warning:: Task-generated mapping cannot be utilized with ``TriggerRule.ALWAYS``
113
+
114
+
Assigning ``trigger_rule=TriggerRule.ALWAYS`` in task-generated mapping is not allowed, as expanded parameters are undefined with the task's immediate execution.
115
+
This is enforced at the time of the DAG parsing, for both tasks and mapped tasks groups, and will raise an error if you try to use it.
116
+
In the recent example, setting ``trigger_rule=TriggerRule.ALWAYS`` in the ``consumer`` task will raise an error since ``make_list`` is a task-generated mapping.
``TriggerRule.ALWAYS`` cannot be utilized within a task-generated mapping, either in bare tasks (fixed in this PR) or mapped task groups (fixed in PR #44368). The issue with doing so, is that the task is immediately executed without waiting for the upstreams's mapping results, which certainly leads to failure of the task. This fix avoids it by raising an exception when it is detected during DAG parsing.
0 commit comments