sunank200 commented on code in PR #53389:
URL: https://github.com/apache/airflow/pull/53389#discussion_r2288466684


##########
task-sdk/src/airflow/sdk/exceptions.py:
##########
@@ -68,3 +69,22 @@ def __str__(self) -> str:
         for arg in self.args[1:]:
             typename = f"{typename}[{type(arg).__qualname__}]"
         return f"unmappable return type {typename!r}"
+
+
+class FailFastDagInvalidTriggerRule(AirflowException):
+    """Raise when a dag has 'fail_fast' enabled yet has a non-default trigger 
rule."""
+
+    _allowed_rules = (TriggerRule.ALL_SUCCESS, 
TriggerRule.ALL_DONE_SETUP_SUCCESS)
+
+    @classmethod
+    def check(cls, *, fail_fast: bool, trigger_rule: TriggerRule):
+        """
+        Check that fail_fast dag tasks have allowable trigger rules.
+
+        :meta private:
+        """
+        if fail_fast and trigger_rule not in cls._allowed_rules:
+            raise cls()
+
+    def __str__(self) -> str:
+        return f"A 'fail_fast' dag can only have {TriggerRule.ALL_SUCCESS} 
trigger rule"

Review Comment:
   I have moved the test to sdk.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to