KlarenceNicolasCatalan commented on code in PR #55660:
URL: https://github.com/apache/airflow/pull/55660#discussion_r2386439485
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_instances.py:
##########
@@ -770,12 +770,19 @@ 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,
- )
+ if body.is_running_message:
+ for ti in task_instances:
+ ti.is_running_message = body.is_running_message
+
+ try:
+ clear_task_instances(
+ task_instances,
+ session,
+ DagRunState.QUEUED if reset_dag_runs else False,
+ run_on_latest_version=body.run_on_latest_version,
+ )
+ except ValueError as e:
Review Comment:
Hello, thanks for the comment!
I added an if conditional in taskInstance.py to raise a ValueError and stop
another clearTaskInstance from running. This way, it prevents starting a task
that’s already running and raises a Bad Request exception in task_instances.
Does this approach cause more issues, or is the error code not the right one to
use?
--
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]