Skip to content

Commit dce93f7

Browse files
Bobbins228astefanutti
authored andcommitted
Removed get cluster fix
1 parent 27908c2 commit dce93f7

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/codeflare_sdk/cluster/cluster.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ def torchx_config(
492492
to_return["requirements"] = requirements
493493
return to_return
494494

495-
def from_k8_cluster_object(rc, mcad=True, ingress_domain=None):
495+
def from_k8_cluster_object(rc, mcad=True):
496496
machine_types = (
497497
rc["metadata"]["labels"]["orderedinstance"].split("_")
498498
if "orderedinstance" in rc["metadata"]["labels"]
@@ -532,7 +532,6 @@ def from_k8_cluster_object(rc, mcad=True, ingress_domain=None):
532532
]["image"],
533533
local_interactive=local_interactive,
534534
mcad=mcad,
535-
ingress_domain=ingress_domain,
536535
)
537536
return Cluster(cluster_config)
538537

@@ -670,7 +669,7 @@ def get_current_namespace(): # pragma: no cover
670669
return None
671670

672671

673-
def get_cluster(cluster_name: str, namespace: str = "default", ingress_domain=None):
672+
def get_cluster(cluster_name: str, namespace: str = "default"):
674673
try:
675674
config_check()
676675
api_instance = client.CustomObjectsApi(api_config_handler())
@@ -686,9 +685,7 @@ def get_cluster(cluster_name: str, namespace: str = "default", ingress_domain=No
686685
for rc in rcs["items"]:
687686
if rc["metadata"]["name"] == cluster_name:
688687
mcad = _check_aw_exists(cluster_name, namespace)
689-
return Cluster.from_k8_cluster_object(
690-
rc, mcad=mcad, ingress_domain=ingress_domain
691-
)
688+
return Cluster.from_k8_cluster_object(rc, mcad=mcad)
692689
raise FileNotFoundError(
693690
f"Cluster {cluster_name} is not found in {namespace} namespace"
694691
)

tests/unit_test.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1787,9 +1787,11 @@ def test_get_cluster(mocker):
17871787
"kubernetes.client.CustomObjectsApi.list_namespaced_custom_object",
17881788
side_effect=get_ray_obj,
17891789
)
1790-
cluster = get_cluster(
1791-
cluster_name="quicktest", ingress_domain="apps.cluster.awsroute.org"
1790+
mocker.patch(
1791+
"codeflare_sdk.utils.generate_yaml.is_openshift_cluster",
1792+
return_value=True,
17921793
)
1794+
cluster = get_cluster(cluster_name="quicktest")
17931795
cluster_config = cluster.config
17941796
assert cluster_config.name == "quicktest" and cluster_config.namespace == "ns"
17951797
assert (
@@ -1800,7 +1802,6 @@ def test_get_cluster(mocker):
18001802
assert cluster_config.min_memory == 2 and cluster_config.max_memory == 2
18011803
assert cluster_config.num_gpus == 0
18021804
assert cluster_config.instascale
1803-
assert cluster_config.ingress_domain == "apps.cluster.awsroute.org"
18041805
assert (
18051806
cluster_config.image
18061807
== "ghcr.io/foundation-model-stack/base:ray2.1.0-py38-gpu-pytorch1.12.0cu116-20221213-193103"

0 commit comments

Comments
 (0)