You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/07/14 02:51:13 UTC

[GitHub] [airflow] uranusjr commented on a change in pull request #16741: Fix race condition with dagrun callbacks

uranusjr commented on a change in pull request #16741:
URL: https://github.com/apache/airflow/pull/16741#discussion_r669241514



##########
File path: airflow/jobs/scheduler_job.py
##########
@@ -856,13 +857,18 @@ def _do_scheduling(self, session) -> int:
                 # But this would take care of the scenario when the Scheduler is restarted after DagRun is
                 # created and the DAG is deleted / renamed
                 try:
-                    self._schedule_dag_run(dag_run, session)
+                    callback_to_run = self._schedule_dag_run(dag_run, session)
+                    callback_tuples.append((dag_run, callback_to_run))
                 except SerializedDagNotFound:
                     self.log.exception("DAG '%s' not found in serialized_dag table", dag_run.dag_id)
                     continue
 
             guard.commit()
 
+            # We will send the callbacks after we commit to ensure the context is up to date when it gets run

Review comment:
       ```suggestion
               # Send the callbacks after we commit to ensure the context is up to date when it gets run
   ```
   
   The “we will” part doesn’t sound right to me; the callbacks *are* being sent now, not some time in the future.




-- 
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: commits-unsubscribe@airflow.apache.org

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