ephraimbuddy commented on a change in pull request #21413:
URL: https://github.com/apache/airflow/pull/21413#discussion_r803352833



##########
File path: airflow/jobs/scheduler_job.py
##########
@@ -1083,6 +1083,7 @@ def _schedule_dag_run(
         # TODO[HA]: Rename update_state -> schedule_dag_run, ?? something else?
         schedulable_tis, callback_to_run = 
dag_run.update_state(session=session, execute_callbacks=False)
         if dag_run.state in State.finished:
+            session.flush()  # to update the dag_run state

Review comment:
       I think there's no harm in having a flush here. The dag_run is already 
in a finished state but a new query at that point doesn't see it as such.
   At 
https://github.com/apache/airflow/pull/21413/files#diff-bde85feb359b12bdd358aed4106ef4fccbd8fa9915e16b9abb7502912a1c1ab3R1058,
  a flush was used when the dag_run was marked failed. I think the same can be 
done here, plus not running `dag_run.schedule_tis` when the dag_run is in a 
finished state




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