potiuk commented on code in PR #29516:
URL: https://github.com/apache/airflow/pull/29516#discussion_r1106524576
##########
airflow/jobs/base_job.py:
##########
@@ -245,32 +246,47 @@ def heartbeat(self, only_if_necessary: bool = False):
# We didn't manage to heartbeat, so make sure that the timestamp
isn't updated
self.latest_heartbeat = previous_heartbeat
+ @staticmethod
+ @internal_api_call
+ @provide_session
+ def pre_execute(job: BaseJob, *, session: Session = NEW_SESSION) -> None:
+ """Update the database job entry before running the _execute()
function."""
+ job.state = State.RUNNING
+ session.add(job)
+ session.commit()
+ make_transient(job)
Review Comment:
(BTW. This is the first case I see we try to do that, so it's not a general
issue so far).
--
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]