amoghrajesh commented on code in PR #77015:
URL: https://github.com/apache/airflow/pull/77015#discussion_r4663999389
##########
task-sdk/src/airflow/sdk/bases/resumablejobmixin.py:
##########
@@ -225,6 +249,32 @@ def persist_job_id(self, context: Context, external_id:
JsonValue) -> None:
external_id=external_id,
)
+ def resume_failed_job(self, external_id: JsonValue, status: str, context:
Context) -> JsonValue | None:
+ """
+ Ask the external system to resume a failed job from where it stopped,
instead of starting over.
+
+ Called on a retry when the stored job is in a terminal failed state.
Return the ID to poll,
+ which may be the same ID (for example a Databricks run repaired in
place) or a new one. Return
+ ``None`` to submit a fresh job, which is the default.
+
+ Only called when ``resume_on_retry`` is set. A cleared task reaches it
only when the clear kept
+ task state, because clearing otherwise discards the stored ID.
+ """
+ return None
+
+ def _resume_failed_job_safely(self, external_id: JsonValue, status: str,
context: Context) -> JsonValue:
+ try:
+ return self.resume_failed_job(external_id, status, context)
+ except Exception:
+ # A failed resume must never leave a retry worse off than
resubmitting.
Review Comment:
Handled in 04ec2532edb
##########
task-sdk/src/airflow/sdk/bases/resumablejobmixin.py:
##########
@@ -145,7 +151,9 @@ def get_resume_decision(self, context: Context) ->
ResumeDecision:
"""
Decide whether to reconnect to the stored job, take its result, or
submit a new one.
- Never submits or polls, so a deferrable operator can call it before
``defer()``.
+ Never submits or polls, so a deferrable operator can call it before
``defer()``. The one
Review Comment:
Handled in 04ec2532edb
--
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]