amoghrajesh commented on code in PR #68067:
URL: https://github.com/apache/airflow/pull/68067#discussion_r3393347594
##########
providers/apache/spark/src/airflow/providers/apache/spark/operators/spark_submit.py:
##########
@@ -269,11 +279,12 @@ def execute(self, context: Context) -> None:
self.poll_until_complete(driver_id, context)
return self.get_job_result(driver_id, context)
if hook._should_track_driver_via_k8s_api():
- # TODO: Wire into execute_resumable() via ResumableJobMixin
- # (fill submit_job / poll_until_complete K8s stubs) to enable
crash recovery.
- hook.submit(self.application)
- hook._poll_k8s_driver_via_api()
- return
+ if self.reconnect_on_retry:
+ return self.execute_resumable(context)
+ # reconnect_on_retry=False: still submit-and-poll, just skip
task_state persistence.
Review Comment:
Oh god, good catch. The risk is real: a later retry with
`reconnect_on_retry=True` reads the stale "Succeeded" from a previous
non-resumable run and exits immediately, treating a newly-submitted pod as
complete. Fixed by gating the write on `self.reconnect_on_retry`, the cache
only exists to serve crash recovery so there's no reason to write it when
reconnect is off. Added a test to cover this.
--
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]