Skip to content

Detect Spark driver completion by container state when tracking via k8s API - #68048

Open
karenbraganz wants to merge 17 commits into
apache:mainfrom
karenbraganz:spark-container-status
Open

Detect Spark driver completion by container state when tracking via k8s API#68048
karenbraganz wants to merge 17 commits into
apache:mainfrom
karenbraganz:spark-container-status

Conversation

@karenbraganz

@karenbraganzkarenbraganz commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

This PR tracks Spark job completion by container state instead of pod phase when track_driver_via_k8s_api=True. Sometimes the pod continues to run even after the driver container completes due to other sidecar containers. This PR makes driver completion detection more accurate by examining the container itself.

@karenbraganz

karenbraganz commented Jun 5, 2026

Copy link
Copy Markdown
CollaboratorAuthor

I still need to test this out and write unit tests.

@karenbraganz

Copy link
Copy Markdown
CollaboratorAuthor

This has passed all unit tests as well as a manual test that I ran.

@aaron-y-chenaaron-y-chen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also document the changes made in this PR in providers/apache/spark/docs/operators.rst?

Raises ``RuntimeError`` on failure phases or unrecoverable API errors.
"""
pod_name = self._kubernetes_driver_pod
driver_container_name = self.kubernetes_driver_container

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make the naming consistent? Like:

k8s_driver_container_name=self.k8s_driver_container_name

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

For spark operator with track_driver_via_k8s_api, detect driver completion by container status rather than pod phase

3 participants

@karenbraganz@uranusjr@aaron-y-chen