Skip to content

Commit 5bd5848

Browse files
committed
Addressed comments & added SUSPENDED status
1 parent 8ae0283 commit 5bd5848

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

Diff for: src/codeflare_sdk/cluster/cluster.py

+3
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,9 @@ def status(
324324
# check the ray cluster status
325325
cluster = _ray_cluster_status(self.config.name, self.config.namespace)
326326
if cluster:
327+
if cluster.status == RayClusterStatus.SUSPENDED:
328+
ready = False
329+
status = CodeFlareClusterStatus.SUSPENDED
327330
if cluster.status == RayClusterStatus.UNKNOWN:
328331
ready = False
329332
status = CodeFlareClusterStatus.STARTING

Diff for: src/codeflare_sdk/cluster/model.py

+2
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

Diff for: src/codeflare_sdk/templates/base-template.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ spec:
4242
metadata:
4343
labels:
4444
workload.codeflare.dev/appwrapper: "aw-kuberay"
45-
kueue.x-k8s.io/queue-name: local-queue
4645
controller-tools.k8s.io: "1.0"
4746
# A unique identifier for the head node and workers of this cluster.
4847
name: kuberay-cluster

Diff for: src/codeflare_sdk/utils/generate_yaml.py

+10-7
Original file line numberDiff line numberDiff line change
@@ -544,9 +544,6 @@ def write_user_appwrapper(user_yaml, output_file_name):
544544
os.makedirs(directory_path)
545545

546546
with open(output_file_name, "w") as outfile:
547-
del user_yaml["spec"]["resources"]["GenericItems"][0]["generictemplate"][
548-
"metadata"
549-
]["labels"]["kueue.x-k8s.io/queue-name"]
550547
yaml.dump(user_yaml, outfile, default_flow_style=False)
551548

552549
print(f"Written to: {output_file_name}")
@@ -625,7 +622,8 @@ def _create_oauth_sidecar_object(
625622
)
626623

627624

628-
def update_local_kueue_label(local_queue: str, namespace: str):
625+
def get_default_kueue_name(local_queue: str, namespace: str):
626+
# If the local queue is set, use it. Otherwise, try to use the default queue.
629627
if local_queue is not None:
630628
return local_queue
631629
else:
@@ -675,9 +673,14 @@ def write_components(
675673
del component["generictemplate"]["metadata"]["labels"][
676674
"workload.codeflare.dev/appwrapper"
677675
]
678-
component["generictemplate"]["metadata"]["labels"][
679-
"kueue.x-k8s.io/queue-name"
680-
] = update_local_kueue_label(local_queue, namespace)
676+
labels = component["generictemplate"]["metadata"]["labels"]
677+
labels.update(
678+
{
679+
"kueue.x-k8s.io/queue-name": get_default_kueue_name(
680+
local_queue, namespace
681+
)
682+
}
683+
)
681684
outfile.write("---\n")
682685
yaml.dump(
683686
component["generictemplate"], outfile, default_flow_style=False

0 commit comments

Comments
 (0)