You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "uranusjr (via GitHub)" <gi...@apache.org> on 2023/07/26 08:02:26 UTC

[GitHub] [airflow] uranusjr commented on a diff in pull request #32820: Support task mapping with setup teardown

uranusjr commented on code in PR #32820:
URL: https://github.com/apache/airflow/pull/32820#discussion_r1274530647


##########
airflow/decorators/base.py:
##########
@@ -382,7 +382,15 @@ def expand(self, **map_kwargs: OperatorExpandArgument) -> XComArg:
         prevent_duplicates(self.kwargs, map_kwargs, fail_reason="mapping already partial")
         # Since the input is already checked at parse time, we can set strict
         # to False to skip the checks on execution.
-        return self._expand(DictOfListsExpandInput(map_kwargs), strict=False)
+        if self.is_teardown:
+            if "trigger_rule" in self.kwargs:
+                raise ValueError("Trigger rule not configurable for teardown tasks.")
+            self.kwargs.update(trigger_rule=TriggerRule.ALL_DONE_SETUP_SUCCESS)
+        obj = self._expand(DictOfListsExpandInput(map_kwargs), strict=False)
+        obj.is_setup = self.is_setup
+        obj.is_teardown = self.is_teardown
+        obj.on_failure_fail_dagrun = self.on_failure_fail_dagrun

Review Comment:
   These very likely should be done in `_expand` instead to account for other call paths.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org