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


##########
airflow/exceptions.py:
##########
@@ -207,6 +207,22 @@ def __init__(self, *args, **kwargs):
         warnings.warn("DagFileExists is deprecated and will be removed.", 
DeprecationWarning, stacklevel=2)
 
 
+class DagInvalidTriggerRule(AirflowException):
+    """Raise when a dag has 'fail_stop' enabled yet has a non-default trigger 
rule"""
+
+    @staticmethod
+    def check(dag: DAG | None, trigger_rule: str):
+        from airflow.models.abstractoperator import DEFAULT_TRIGGER_RULE
+
+        if dag is not None and dag.fail_stop and trigger_rule != 
DEFAULT_TRIGGER_RULE:
+            raise DagInvalidTriggerRule()

Review Comment:
   Seems simpler if this is a classmethod and use `raise cls`?



-- 
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