fix(spark): clean up session and port-forward on failure - #779
fix(spark): clean up session and port-forward on failure#779shreya-024 wants to merge 3 commits into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
🎉 Welcome to the Kubeflow SDK! 🎉 Thanks for opening your first PR! We're happy to have you as part of our community 🚀 Here's what happens next:
Join the community:
Feel free to ask questions in the comments if you need any help or clarification! |
There was a problem hiding this comment.
Hi @shreya-024! I have added a few comments.
Please also follow these instructions to sign your commits: https://github.com/kubeflow/sdk/pull/779/checks?check_run_id=100012874640.
| RUNNING = "Running" # Operator may set this when server is up; treated as ready | ||
| NOT_READY = "NotReady" | ||
| FAILED = "Failed" | ||
| UNKNOWN = "Unknown" |
There was a problem hiding this comment.
Please remove UNKNOWN = "Unknown".
| state = SparkConnectState(spark_connect_cr.status.state) | ||
| except ValueError: | ||
| state = SparkConnectState.PROVISIONING | ||
| state = SparkConnectState.UNKNOWN |
There was a problem hiding this comment.
Please use this instead.
sdk/kubeflow/common/constants.py
Lines 21 to 22 in 3febcd7
There was a problem hiding this comment.
The RUNNING state should be removed.
| if info.state == SparkConnectState.READY: | |
| logger.info( |
| @@ -32,6 +32,7 @@ class SparkConnectState(str, Enum): | |||
| RUNNING = "Running" # Operator may set this when server is up; treated as ready | |||
There was a problem hiding this comment.
The RUNNING state should be removed.
|
/ok-to-test |
|
/assign |
Signed-off-by: shreya-024 <shreyak.2406@gmail.com>
Signed-off-by: shreya-024 <shreyak.2406@gmail.com>
8d74bdc to
92e552c
Compare
vjkumar2756
left a comment
There was a problem hiding this comment.
LGTM
@shreya-024
I went through the changes, and the cleanup handling looks solid. Mapping unrecognized states to UNKNOWN, cleaning up the SparkConnect CR on failure, and terminating the port forward subprocess should prevent orphaned resources and state mismatches.
tariq-hasan
left a comment
There was a problem hiding this comment.
Hi @shreya-024! I have added a few comments.
| RUNNING = "Running" # Operator may set this when server is up; treated as ready | ||
| NOT_READY = "NotReady" | ||
| FAILED = "Failed" | ||
| UNKNOWN = "Unknown" |
There was a problem hiding this comment.
Please remove UNKNOWN = "Unknown".
| from enum import Enum | ||
| import logging | ||
| from typing import Any | ||
|
|
There was a problem hiding this comment.
Let's add import kubeflow.common.constants as common_constants.
There was a problem hiding this comment.
Let's rewrite as follows.
| state: str = common_constants.UNKNOWN |
There was a problem hiding this comment.
Same here
| status: str = common_constants.UNKNOWN |
| state = SparkConnectState(spark_connect_cr.status.state) | ||
| except ValueError: | ||
| state = SparkConnectState.PROVISIONING | ||
| state = SparkConnectState(common_constants.UNKNOWN) |
There was a problem hiding this comment.
| state = SparkConnectState(common_constants.UNKNOWN) | |
| state = common_constants.UNKNOWN |
| f"{self.namespace}/{name} (timeout: {timeout}s)" | ||
| ) | ||
|
|
||
| time.sleep(polling_interval) |
There was a problem hiding this comment.
We need to be able to retry for transient errors.
Signed-off-by: shreya-024 <shreyak.2406@gmail.com>
What this PR does / why we need it:
Fixes the SparkConnect resource handling gap identified in #476.
Which issue(s) this PR fixes: