ashb commented on a change in pull request #21731:
URL: https://github.com/apache/airflow/pull/21731#discussion_r820821813



##########
File path: airflow/jobs/scheduler_job.py
##########
@@ -858,7 +865,7 @@ def _do_scheduling(self, session) -> int:
                     self.log.error("DAG '%s' not found in serialized_dag 
table", dag_run.dag_id)
                     continue
 
-                self._send_dag_callbacks_to_processor(dag, callback_to_run)
+                callbacks_to_send.append((dag, callback_to_run))

Review comment:
       Yeah make sense Jarek:
   
   ```python
           with prohibit_commit(session) as guard:
               ...
               guard.commit()
   
           # Send the callbacks after we commit to ensure the context is up to 
date when it gets run
           for dag_run, callback_to_run in callback_tuples:
               dag = self.dagbag.get_dag(dag_run.dag_id, session=session)
               if not dag:
                   self.log.error("DAG '%s' not found in serialized_dag table", 
dag_run.dag_id)
                   continue
   
               self._send_dag_callbacks_to_processor(dag, callback_to_run)
   
           with prohibit_commit(session) as guard:
   ```




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