Skip to content

Commit 9246b81

Browse files
committed
Addressed comments & added SUSPENDED status
1 parent dd70a64 commit 9246b81

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

src/codeflare_sdk/cluster/cluster.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,9 @@ def status(
334334
# check the ray cluster status
335335
cluster = _ray_cluster_status(self.config.name, self.config.namespace)
336336
if cluster:
337+
if cluster.status == RayClusterStatus.SUSPENDED:
338+
ready = False
339+
status = CodeFlareClusterStatus.SUSPENDED
337340
if cluster.status == RayClusterStatus.UNKNOWN:
338341
ready = False
339342
status = CodeFlareClusterStatus.STARTING

src/codeflare_sdk/cluster/model.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class RayClusterStatus(Enum):
3232
UNHEALTHY = "unhealthy"
3333
FAILED = "failed"
3434
UNKNOWN = "unknown"
35+
SUSPENDED = "suspended"
3536

3637

3738
class AppWrapperStatus(Enum):
@@ -59,6 +60,7 @@ class CodeFlareClusterStatus(Enum):
5960
QUEUEING = 4
6061
FAILED = 5
6162
UNKNOWN = 6
63+
SUSPENDED = 7
6264

6365

6466
@dataclass

src/codeflare_sdk/templates/base-template.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ spec:
4444
sdk.codeflare.dev/local_interactive: "False"
4545
labels:
4646
workload.codeflare.dev/appwrapper: "aw-kuberay"
47-
kueue.x-k8s.io/queue-name: local-queue
4847
controller-tools.k8s.io: "1.0"
4948
# A unique identifier for the head node and workers of this cluster.
5049
name: kuberay-cluster

src/codeflare_sdk/utils/generate_yaml.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -557,9 +557,6 @@ def write_user_appwrapper(user_yaml, output_file_name):
557557
os.makedirs(directory_path)
558558

559559
with open(output_file_name, "w") as outfile:
560-
del user_yaml["spec"]["resources"]["GenericItems"][0]["generictemplate"][
561-
"metadata"
562-
]["labels"]["kueue.x-k8s.io/queue-name"]
563560
yaml.dump(user_yaml, outfile, default_flow_style=False)
564561

565562
print(f"Written to: {output_file_name}")
@@ -638,7 +635,8 @@ def _create_oauth_sidecar_object(
638635
)
639636

640637

641-
def update_local_kueue_label(local_queue: str, namespace: str):
638+
def get_default_kueue_name(local_queue: str, namespace: str):
639+
# If the local queue is set, use it. Otherwise, try to use the default queue.
642640
if local_queue is not None:
643641
return local_queue
644642
else:
@@ -688,9 +686,14 @@ def write_components(
688686
del component["generictemplate"]["metadata"]["labels"][
689687
"workload.codeflare.dev/appwrapper"
690688
]
691-
component["generictemplate"]["metadata"]["labels"][
692-
"kueue.x-k8s.io/queue-name"
693-
] = update_local_kueue_label(local_queue, namespace)
689+
labels = component["generictemplate"]["metadata"]["labels"]
690+
labels.update(
691+
{
692+
"kueue.x-k8s.io/queue-name": get_default_kueue_name(
693+
local_queue, namespace
694+
)
695+
}
696+
)
694697
outfile.write("---\n")
695698
yaml.dump(
696699
component["generictemplate"], outfile, default_flow_style=False

0 commit comments

Comments
 (0)