Skip to content

Commit 49df838

Browse files
committed
Updated model worker resource requests/limits
1 parent 33eb4b4 commit 49df838

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

src/codeflare_sdk/cluster/cluster.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -880,10 +880,10 @@ def _map_to_ray_cluster(rc) -> Optional[RayCluster]:
880880
status=status,
881881
# for now we are not using autoscaling so same replicas is fine
882882
workers=rc["spec"]["workerGroupSpecs"][0]["replicas"],
883-
worker_mem_max=rc["spec"]["workerGroupSpecs"][0]["template"]["spec"][
883+
worker_mem_limits=rc["spec"]["workerGroupSpecs"][0]["template"]["spec"][
884884
"containers"
885885
][0]["resources"]["limits"]["memory"],
886-
worker_mem_min=rc["spec"]["workerGroupSpecs"][0]["template"]["spec"][
886+
worker_mem_requests=rc["spec"]["workerGroupSpecs"][0]["template"]["spec"][
887887
"containers"
888888
][0]["resources"]["requests"]["memory"],
889889
worker_cpu=rc["spec"]["workerGroupSpecs"][0]["template"]["spec"]["containers"][
@@ -927,8 +927,8 @@ def _copy_to_ray(cluster: Cluster) -> RayCluster:
927927
name=cluster.config.name,
928928
status=cluster.status(print_to_console=False)[0],
929929
workers=cluster.config.num_workers,
930-
worker_mem_min=cluster.config.worker_memory_requests,
931-
worker_mem_max=cluster.config.worker_memory_limits,
930+
worker_mem_requests=cluster.config.worker_memory_requests,
931+
worker_mem_limits=cluster.config.worker_memory_limits,
932932
worker_cpu=cluster.config.worker_cpu_requests,
933933
worker_gpu=cluster.config.num_worker_gpus,
934934
namespace=cluster.config.namespace,

src/codeflare_sdk/cluster/model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ class RayCluster:
7878
head_mem_limits: str
7979
head_gpu: int
8080
workers: int
81-
worker_mem_min: str
82-
worker_mem_max: str
81+
worker_mem_requests: str
82+
worker_mem_limits: str
8383
worker_cpu: int
8484
worker_gpu: int
8585
namespace: str

src/codeflare_sdk/utils/pretty_print.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def print_clusters(clusters: List[RayCluster]):
136136
name = cluster.name
137137
dashboard = cluster.dashboard
138138
workers = str(cluster.workers)
139-
memory = f"{cluster.worker_mem_min}~{cluster.worker_mem_max}"
139+
memory = f"{cluster.worker_mem_requests}~{cluster.worker_mem_limits}"
140140
cpu = str(cluster.worker_cpu)
141141
gpu = str(cluster.worker_gpu)
142142

tests/unit_test.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -893,8 +893,8 @@ def test_ray_details(mocker, capsys):
893893
name="raytest1",
894894
status=RayClusterStatus.READY,
895895
workers=1,
896-
worker_mem_min="2G",
897-
worker_mem_max="2G",
896+
worker_mem_requests="2G",
897+
worker_mem_limits="2G",
898898
worker_cpu=1,
899899
worker_gpu=0,
900900
namespace="ns",
@@ -934,8 +934,8 @@ def test_ray_details(mocker, capsys):
934934
assert ray2.name == "raytest2"
935935
assert ray1.namespace == ray2.namespace
936936
assert ray1.workers == ray2.workers
937-
assert ray1.worker_mem_min == ray2.worker_mem_min
938-
assert ray1.worker_mem_max == ray2.worker_mem_max
937+
assert ray1.worker_mem_requests == ray2.worker_mem_requests
938+
assert ray1.worker_mem_limits == ray2.worker_mem_limits
939939
assert ray1.worker_cpu == ray2.worker_cpu
940940
assert ray1.worker_gpu == ray2.worker_gpu
941941
try:
@@ -2322,8 +2322,8 @@ def test_cluster_status(mocker):
23222322
name="test",
23232323
status=RayClusterStatus.UNKNOWN,
23242324
workers=1,
2325-
worker_mem_min=2,
2326-
worker_mem_max=2,
2325+
worker_mem_requests=2,
2326+
worker_mem_limits=2,
23272327
worker_cpu=1,
23282328
worker_gpu=0,
23292329
namespace="ns",

0 commit comments

Comments
 (0)