ashb commented on a change in pull request #8227:
URL: https://github.com/apache/airflow/pull/8227#discussion_r433172534



##########
File path: airflow/api/common/experimental/trigger_dag.py
##########
@@ -68,15 +68,17 @@ def _trigger_dag(
                     execution_date.isoformat(),
                     min_dag_start_date.isoformat()))
 
+    run_type: Optional[DagRunType] = None
     if not run_id:
-        run_id = f"{DagRunType.MANUAL.value}__{execution_date.isoformat()}"
-
-    dag_run_id = dag_run.find(dag_id=dag_id, run_id=run_id)
-    if dag_run_id:
-        raise DagRunAlreadyExists("Run id {} already exists for dag id 
{}".format(
-            run_id,
-            dag_id
-        ))
+        run_type = DagRunType.MANUAL
+        dag_run = dag_run.find(dag_id=dag_id, run_type=run_type, 
execution_date=execution_date)

Review comment:
       Is there is already a scheduled dag_run for this exact time, this 
`find()` will fail to find anything, but the unique constraint (on 
exeuction_date, dag_id) would still be violated.




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

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


Reply via email to