KlarenceNicolasCatalan commented on code in PR #56351:
URL: https://github.com/apache/airflow/pull/56351#discussion_r2488945615


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_instances.py:
##########
@@ -793,12 +793,16 @@ def post_clear_task_instances(
         )
 
     if not dry_run:
-        clear_task_instances(
-            task_instances,
-            session,
-            DagRunState.QUEUED if reset_dag_runs else False,
-            run_on_latest_version=body.run_on_latest_version,
-        )
+        try:
+            clear_task_instances(
+                task_instances,
+                session,
+                DagRunState.QUEUED if reset_dag_runs else False,
+                run_on_latest_version=body.run_on_latest_version,
+                prevent_running_task=body.prevent_running_task,
+            )
+        except AirflowClearRunningTaskException as e:
+            raise HTTPException(status.HTTP_400_BAD_REQUEST, str(e)) from e

Review Comment:
   Now that you say it, 409 does also make sense since it can mean that the 
state of the task is the reason for the exception. I just thought that 400 
means that the client failed to clear the task as per request or something like 
that, so I went with 400. If that is the case, should I replace the 400 error 
code for a 409?



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