guan404ming commented on code in PR #61833:
URL: https://github.com/apache/airflow/pull/61833#discussion_r2815362696


##########
airflow-core/src/airflow/api_fastapi/execution_api/routes/dag_runs.py:
##########
@@ -112,6 +112,15 @@ def trigger_dag_run(
             },
         )
 
+    if dm.allowed_run_types is not None and DagRunType.MANUAL.value not in 
dm.allowed_run_types:
+        raise HTTPException(
+            status.HTTP_400_BAD_REQUEST,
+            detail={
+                "reason": "denied_run_type",
+                "message": f"Dag with dag_id '{dag_id}' does not allow manual 
runs",
+            },
+        )
+

Review Comment:
   Good catch. `TriggerDagRunOperator` creates `MANUAL` runs, so the check is 
consistent with the current behavior. But you're right that operator-triggered 
runs are semantically different from user-initiated manual runs. A dedicated 
run type for operator-triggered runs could address this, but that's a larger 
change. I just added a TODO comment for now and I think I could follow up one 
to update more dedicated run type here.



##########
airflow-core/src/airflow/api_fastapi/execution_api/routes/dag_runs.py:
##########
@@ -112,6 +112,15 @@ def trigger_dag_run(
             },
         )
 
+    if dm.allowed_run_types is not None and DagRunType.MANUAL.value not in 
dm.allowed_run_types:
+        raise HTTPException(
+            status.HTTP_400_BAD_REQUEST,
+            detail={
+                "reason": "denied_run_type",
+                "message": f"Dag with dag_id '{dag_id}' does not allow manual 
runs",
+            },
+        )
+

Review Comment:
   Good catch. Currently `TriggerDagRunOperator` creates `MANUAL` runs, so the 
check is consistent with the current behavior. But you're right that 
operator-triggered runs are semantically different from user-initiated manual 
runs. A dedicated run type for operator-triggered runs could address this, but 
that's a larger change. I just added a TODO comment for now and I think I could 
follow up one to update more dedicated run type here.



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