kaxil commented on code in PR #77161:
URL: https://github.com/apache/airflow/pull/77161#discussion_r4594317157
##########
task-sdk/src/airflow/sdk/bases/resumablejobmixin.py:
##########
@@ -122,88 +130,100 @@ def execute_resumable(self, context: Context) -> Any:
self.poll_until_complete(external_id, context)
return self.get_job_result(external_id, context)
+ decision = self.get_resume_decision(context)
+ if decision.action == "reconnect":
+ return self.poll_until_complete(decision.external_id, context)
+ if decision.action == "already_succeeded":
+ return self.get_job_result(decision.external_id, context)
+
+ external_id = self.submit_job(context)
+ self.persist_job_id(context, external_id)
+ self.poll_until_complete(external_id, context)
+ return self.get_job_result(external_id, context)
+
+ def get_resume_decision(self, context: Context) -> ResumeDecision:
Review Comment:
These two methods are the public surface a deferrable operator has to call,
but `task-sdk/docs/resumable-job-mixin.rst` still only describes
`execute_resumable` and presents the mixin as an alternative to deferrable
operators. Could the docs get a short section with a `defer()` example that
uses `get_resume_decision` and `persist_job_id`? Also, should `ResumeDecision`
be exported from `airflow.sdk` next to `ResumableJobMixin`, so providers don't
import it from `airflow.sdk.bases.resumablejobmixin`?
--
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]