ferruzzi commented on code in PR #59066:
URL: https://github.com/apache/airflow/pull/59066#discussion_r2590458586
##########
airflow-core/src/airflow/models/taskinstance.py:
##########
@@ -304,6 +304,7 @@ def clear_task_instances(
dr.last_scheduling_decision = None
dr.start_date = None
dr.clear_number += 1
+ dr.queued_at = timezone.utcnow()
Review Comment:
I don't have all of your answers, and that may indicate that this isn't the
best fix. I'll answer what I can:
I added the Deadline Alerts feature a little while back and someone asked
"When I clear a dag run, does the deadline get recalculated?" I said that it
should behave that way, yes. But when I actually tested it on a real dag, it
was not. Following that trail I found out that when you click the "clear dag
run" button in the UI, the queued_at timestamp doesn't actually change. The
deadline is being recalculated, but since the queued_at timestamp wasn't
updated, it was just calculating the same time. If you run a dag and monitor
the 'dag_run` table, when you click "clear dag run" in the UI you can see the
state move back to QUEUED, but the queued_at column does not change.
I am pretty sure that the code you are looking at isn't hit when you clear
the dag run. When a user clicks the "clear dag run" button on the UI, the call
chain is
`airflow/api_fastapi/core_api/routes/public/dag_run.py::clear_dag_run)` >>
`airflow/serialization/serialized_objects.py::SerializedDAG.clear` >>
`airflow/models/taskinstance.py::clear_task_instances` and in
`clear_task_instances` we are manually setting the state.
But maybe I just haven't dug deep enough yet to find the actual bug and we
need to put some time into figuring out why the setter wasn't working....
--
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]