pingzh commented on a change in pull request #9616:
URL: https://github.com/apache/airflow/pull/9616#discussion_r453225731



##########
File path: airflow/jobs/local_task_job.py
##########
@@ -135,7 +135,11 @@ def heartbeat_callback(self, session=None):
             self.task_runner.terminate()
             return
 
-        self.task_instance.refresh_from_db()
+        if session is None:
+            self.task_instance.refresh_from_db()
+        else:
+            self.task_instance.refresh_from_db(session=session)

Review comment:
       yep, that was the place I was trying to change. If we always change 
`None` to a real `session` object, the users will not be able to set the 
`session` to `None`, (as the decorator always changes it)  when they don't want 
to create a session. It depends on whether we want `provide_session` to always 
create a `session` even when the user explicitly says i don't want a session to 
be created.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to