Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions airflow/models/baseoperator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1107,9 +1107,7 @@ def dag(self, dag: DAG | None):

if self.__from_mapped:
pass # Don't add to DAG -- the mapped task takes the place.
elif self.task_id not in dag.task_dict:
dag.add_task(self)
elif self.task_id in dag.task_dict and dag.task_dict[self.task_id] is not self:
elif dag.task_dict.get(self.task_id) is not self:
dag.add_task(self)

self._dag = dag
Expand Down
8 changes: 5 additions & 3 deletions airflow/serialization/serialized_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -1000,9 +1000,11 @@ def populate_operator(cls, op: Operator, encoded_op: dict[str, Any]) -> None:
v = {arg: cls.deserialize(value) for arg, value in v.items()}
elif k in {"expand_input", "op_kwargs_expand_input"}:
v = _ExpandInputRef(v["type"], cls.deserialize(v["value"]))
elif k in cls._decorated_fields or k not in op.get_serialized_fields():
v = cls.deserialize(v)
elif k in ("outlets", "inlets"):
elif (
k in cls._decorated_fields
or k not in op.get_serialized_fields()
or k in ("outlets", "inlets")
):
v = cls.deserialize(v)
elif k == "on_failure_fail_dagrun":
k = "_on_failure_fail_dagrun"
Expand Down
15 changes: 1 addition & 14 deletions airflow/ti_deps/deps/trigger_rule_dep.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,20 +471,7 @@ def _evaluate_direct_relatives() -> Iterator[TIDepStatus]:
f"upstream_task_ids={task.upstream_task_ids}"
)
)
elif trigger_rule == TR.NONE_FAILED:
num_failures = upstream - success - skipped
if ti.map_index > -1:
num_failures -= removed
if num_failures > 0:
yield self._failing_status(
reason=(
f"Task's trigger rule '{trigger_rule}' requires all upstream tasks to have "
f"succeeded or been skipped, but found {num_failures} non-success(es). "
f"upstream_states={upstream_states}, "
f"upstream_task_ids={task.upstream_task_ids}"
)
)
elif trigger_rule == TR.NONE_FAILED_MIN_ONE_SUCCESS:
elif trigger_rule == TR.NONE_FAILED or trigger_rule == TR.NONE_FAILED_MIN_ONE_SUCCESS:
num_failures = upstream - success - skipped
if ti.map_index > -1:
num_failures -= removed
Expand Down