Skip to content

Commit 18f8bd5

Browse files
committed
fix(RHOAIENG-25120): remove kueue as mandatory in RayCluster
Signed-off-by: Pat O'Connor <paoconno@redhat.com>
1 parent 028d0d5 commit 18f8bd5

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/codeflare_sdk/ray/cluster/build_ray_cluster.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,9 +488,11 @@ def add_queue_label(cluster: "codeflare_sdk.ray.cluster.Cluster", labels: dict):
488488
if lq_name == None:
489489
return
490490
elif not local_queue_exists(cluster):
491-
raise ValueError(
491+
# ValueError removed to pass validation to validating admission policy
492+
print(
492493
"local_queue provided does not exist or is not in this namespace. Please provide the correct local_queue name in Cluster Configuration"
493494
)
495+
return
494496
labels.update({"kueue.x-k8s.io/queue-name": lq_name})
495497

496498

src/codeflare_sdk/ray/cluster/cluster.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,14 @@ def up(self):
183183
f"Ray Cluster: '{self.config.name}' has successfully been created"
184184
)
185185
except Exception as e: # pragma: no cover
186+
if e.status == 422:
187+
print(
188+
"WARNING: RayCluster creation rejected by the validating admission policy. Please contact your administrator."
189+
)
190+
else:
191+
print(
192+
"WARNING: Failed to create RayCluster due to unexpected error. Please contact your administrator."
193+
)
186194
return _kube_api_error_handling(e)
187195

188196
# Applies a new cluster with the provided or default spec
@@ -231,6 +239,14 @@ def apply(self, force=False):
231239
except AttributeError as e:
232240
raise RuntimeError(f"Failed to initialize DynamicClient: {e}")
233241
except Exception as e: # pragma: no cover
242+
if e.status == 422:
243+
print(
244+
"WARNING: RayCluster creation rejected by the validating admission policy. Please contact your administrator."
245+
)
246+
else:
247+
print(
248+
"WARNING: Failed to create RayCluster due to unexpected error. Please contact your administrator."
249+
)
234250
return _kube_api_error_handling(e)
235251

236252
def _throw_for_no_raycluster(self):

0 commit comments

Comments
 (0)