potiuk commented on code in PR #30308:
URL: https://github.com/apache/airflow/pull/30308#discussion_r1163151297
##########
airflow/jobs/job.py:
##########
@@ -292,3 +265,181 @@ def most_recent_job(job_type: str, session: Session =
NEW_SESSION) -> Job | None
)
.first()
)
+
+
+@provide_session
+def run_job(job: Job | JobPydantic, session: Session = NEW_SESSION) -> int |
None:
+ """
+ Runs the job. The Job is always an ORM object and setting the state is
happening within the
+ same DB session and the session is kept open throughout the whole execution
+
+ :meta private:
+
+ TODO: Maybe we should not keep the session during job execution ?.
+ """
+ if _ENABLE_AIP_44:
+ return _run_job_for_AIP_44(job=job, session=session)
Review Comment:
Yeah, I agree the way it is now is a bit "ugly" and I agree it is in parts
YAGNI case
And I am flexible. I think I can actually remove all the coniditional code
here and rebase the last step of refactor #30376 as now I know how the final
stage will be best (and we can bring back AIP-44 changes as next steps after
2.6 cut-off.
##########
airflow/jobs/job.py:
##########
@@ -292,3 +265,181 @@ def most_recent_job(job_type: str, session: Session =
NEW_SESSION) -> Job | None
)
.first()
)
+
+
+@provide_session
+def run_job(job: Job | JobPydantic, session: Session = NEW_SESSION) -> int |
None:
+ """
+ Runs the job. The Job is always an ORM object and setting the state is
happening within the
+ same DB session and the session is kept open throughout the whole execution
+
+ :meta private:
+
+ TODO: Maybe we should not keep the session during job execution ?.
+ """
+ if _ENABLE_AIP_44:
+ return _run_job_for_AIP_44(job=job, session=session)
Review Comment:
Yeah, I agree the way it is now is a bit "ugly" and I agree it is in parts
YAGNI case
And I am flexible. I think I can actually remove all the conditional code
here and rebase the last step of refactor #30376 as now I know how the final
stage will be best (and we can bring back AIP-44 changes as next steps after
2.6 cut-off.
--
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]