Skip to content

Commit 74f234c

Browse files
LilyLinhopenshift-merge-bot[bot]
authored andcommitted
task(RHOAIENG-30478)Remove Deprecated Params from CodeFlare SDK (head_cpus & head_memory)
1 parent 4531e55 commit 74f234c

File tree

3 files changed

+0
-58
lines changed

3 files changed

+0
-58
lines changed

docs/sphinx/user-docs/cluster-configuration.rst

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -155,20 +155,3 @@ Example configuration:
155155
156156
.. note::
157157
You need to have a Redis instance deployed in your Kubernetes cluster before using this feature.
158-
159-
Deprecating Parameters
160-
----------------------
161-
162-
The following parameters of the ``ClusterConfiguration`` are being
163-
deprecated.
164-
165-
.. list-table::
166-
:header-rows: 1
167-
:widths: auto
168-
169-
* - Deprecated Parameter
170-
- Replaced By
171-
* - ``head_cpus``
172-
- ``head_cpu_requests``, ``head_cpu_limits``
173-
* - ``head_memory``
174-
- ``head_memory_requests``, ``head_memory_limits``

src/codeflare_sdk/ray/cluster/config.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ class ClusterConfiguration:
5050
The name of the cluster.
5151
namespace:
5252
The namespace in which the cluster should be created.
53-
head_cpus:
54-
The number of CPUs to allocate to the head node.
55-
head_memory:
56-
The amount of memory to allocate to the head node.
5753
head_extended_resource_requests:
5854
A dictionary of extended resource requests for the head node. ex: {"nvidia.com/gpu": 1}
5955
head_tolerations:
@@ -104,10 +100,8 @@ class ClusterConfiguration:
104100
namespace: Optional[str] = None
105101
head_cpu_requests: Union[int, str] = 2
106102
head_cpu_limits: Union[int, str] = 2
107-
head_cpus: Optional[Union[int, str]] = None # Deprecating
108103
head_memory_requests: Union[int, str] = 8
109104
head_memory_limits: Union[int, str] = 8
110-
head_memory: Optional[Union[int, str]] = None # Deprecating
111105
head_extended_resource_requests: Dict[str, Union[str, int]] = field(
112106
default_factory=dict
113107
)
@@ -173,10 +167,8 @@ def __post_init__(self):
173167
)
174168

175169
self._validate_types()
176-
self._memory_to_resource()
177170
self._memory_to_string()
178171
self._str_mem_no_unit_add_GB()
179-
self._cpu_to_resource()
180172
self._combine_extended_resource_mapping()
181173
self._validate_extended_resource_requests(self.head_extended_resource_requests)
182174
self._validate_extended_resource_requests(
@@ -209,8 +201,6 @@ def _validate_extended_resource_requests(self, extended_resources: Dict[str, int
209201
)
210202

211203
def _str_mem_no_unit_add_GB(self):
212-
if isinstance(self.head_memory, str) and self.head_memory.isdecimal():
213-
self.head_memory = f"{self.head_memory}G"
214204
if (
215205
isinstance(self.worker_memory_requests, str)
216206
and self.worker_memory_requests.isdecimal()
@@ -232,20 +222,6 @@ def _memory_to_string(self):
232222
if isinstance(self.worker_memory_limits, int):
233223
self.worker_memory_limits = f"{self.worker_memory_limits}G"
234224

235-
def _cpu_to_resource(self):
236-
if self.head_cpus:
237-
warnings.warn(
238-
"head_cpus is being deprecated, use head_cpu_requests and head_cpu_limits"
239-
)
240-
self.head_cpu_requests = self.head_cpu_limits = self.head_cpus
241-
242-
def _memory_to_resource(self):
243-
if self.head_memory:
244-
warnings.warn(
245-
"head_memory is being deprecated, use head_memory_requests and head_memory_limits"
246-
)
247-
self.head_memory_requests = self.head_memory_limits = self.head_memory
248-
249225
def _validate_types(self):
250226
"""Validate the types of all fields in the ClusterConfiguration dataclass."""
251227
errors = []

src/codeflare_sdk/ray/cluster/test_config.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -135,23 +135,6 @@ def test_config_creation_wrong_type():
135135
assert len(str(error_info.value).splitlines()) == 4
136136

137137

138-
@pytest.mark.filterwarnings("ignore::UserWarning")
139-
def test_cluster_config_deprecation_conversion(mocker):
140-
config = ClusterConfiguration(
141-
name="test",
142-
head_cpus=3,
143-
head_memory=16,
144-
)
145-
assert config.head_cpu_requests == 3
146-
assert config.head_cpu_limits == 3
147-
assert config.head_memory_requests == "16G"
148-
assert config.head_memory_limits == "16G"
149-
assert config.worker_memory_requests == "2G"
150-
assert config.worker_memory_limits == "2G"
151-
assert config.worker_cpu_requests == 1
152-
assert config.worker_cpu_limits == 1
153-
154-
155138
def test_gcs_fault_tolerance_config_validation():
156139
config = ClusterConfiguration(
157140
name="test",

0 commit comments

Comments
 (0)