Lee-W commented on code in PR #48214:
URL: https://github.com/apache/airflow/pull/48214#discussion_r2037023281


##########
providers/standard/src/airflow/providers/standard/operators/trigger_dagrun.py:
##########
@@ -131,6 +131,7 @@ class TriggerDagRunOperator(BaseOperator):
         Default is ``[DagRunState.FAILED]``.
     :param skip_when_already_exists: Set to true to mark the task as SKIPPED 
if a DAG run of the triggered
         DAG for the same logical date already exists.
+    :param fail_when_dag_is_paused: If the DAG to trigger is paused, fail the 
task.

Review Comment:
   ```suggestion
       :param fail_when_dag_is_paused: If the dag to trigger is paused, fail 
the task.
   ```



##########
providers/standard/src/airflow/providers/standard/operators/trigger_dagrun.py:
##########
@@ -212,6 +215,11 @@ def execute(self, context: Context):
             else:
                 run_id = DagRun.generate_run_id(DagRunType.MANUAL, 
parsed_logical_date or timezone.utcnow())  # type: ignore[misc,call-arg]
 
+        if self.fail_when_dag_is_paused:
+            dag_model = DagModel.get_current(self.trigger_dag_id)
+            if dag_model.is_paused:
+                raise AirflowException(f"Dag id {self.trigger_dag_id} is 
paused")

Review Comment:
   Please create a custom exception instead of using AirflowException directly



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