@@ -36,8 +36,12 @@ class ClusterConfiguration:
36
36
name : str
37
37
namespace : str = None
38
38
head_info : list = field (default_factory = list )
39
- head_cpus : typing .Union [int , str ] = 2
40
- head_memory : typing .Union [int , str ] = 8
39
+ head_cpu_requests : typing .Union [int , str ] = 2
40
+ head_cpu_limits : typing .Union [int , str ] = 2
41
+ head_cpus : typing .Union [int , str ] = None # Deprecating
42
+ head_memory_requests : typing .Union [int , str ] = 8
43
+ head_memory_limits : typing .Union [int , str ] = 8
44
+ head_memory : typing .Union [int , str ] = None # Deprecating
41
45
head_gpus : int = None # Deprecating
42
46
num_head_gpus : int = 0
43
47
machine_types : list = field (default_factory = list ) # ["m4.xlarge", "g4dn.xlarge"]
@@ -74,8 +78,16 @@ def __post_init__(self):
74
78
self ._cpu_to_resource ()
75
79
76
80
def _str_mem_no_unit_add_GB (self ):
77
- if isinstance (self .head_memory , str ) and self .head_memory .isdecimal ():
78
- self .head_memory = f"{ self .head_memory } G"
81
+ if (
82
+ isinstance (self .head_memory_requests , str )
83
+ and self .head_memory_requests .isdecimal ()
84
+ ):
85
+ self .head_memory_requests = f"{ self .head_memory_requests } G"
86
+ if (
87
+ isinstance (self .head_memory_limits , str )
88
+ and self .head_memory_limits .isdecimal ()
89
+ ):
90
+ self .head_memory_limits = f"{ self .head_memory_limits } G"
79
91
if (
80
92
isinstance (self .worker_memory_requests , str )
81
93
and self .worker_memory_requests .isdecimal ()
@@ -88,8 +100,10 @@ def _str_mem_no_unit_add_GB(self):
88
100
self .worker_memory_limits = f"{ self .worker_memory_limits } G"
89
101
90
102
def _memory_to_string (self ):
91
- if isinstance (self .head_memory , int ):
92
- self .head_memory = f"{ self .head_memory } G"
103
+ if isinstance (self .head_memory_requests , int ):
104
+ self .head_memory_requests = f"{ self .head_memory_requests } G"
105
+ if isinstance (self .head_memory_limits , int ):
106
+ self .head_memory_limits = f"{ self .head_memory_limits } G"
93
107
if isinstance (self .worker_memory_requests , int ):
94
108
self .worker_memory_requests = f"{ self .worker_memory_requests } G"
95
109
if isinstance (self .worker_memory_limits , int ):
@@ -104,6 +118,11 @@ def _gpu_to_resource(self):
104
118
self .num_worker_gpus = self .num_gpus
105
119
106
120
def _cpu_to_resource (self ):
121
+ if self .head_cpus :
122
+ warnings .warn (
123
+ "head_cpus is being deprecated, use head_cpu_requests and head_cpu_limits"
124
+ )
125
+ self .head_cpu_requests = self .head_cpu_limits = self .head_cpus
107
126
if self .min_cpus :
108
127
warnings .warn ("min_cpus is being deprecated, use worker_cpu_requests" )
109
128
self .worker_cpu_requests = self .min_cpus
@@ -112,6 +131,11 @@ def _cpu_to_resource(self):
112
131
self .worker_cpu_limits = self .max_cpus
113
132
114
133
def _memory_to_resource (self ):
134
+ if self .head_memory :
135
+ warnings .warn (
136
+ "head_memory is being deprecated, use head_memory_requests and head_memory_limits"
137
+ )
138
+ self .head_memory_requests = self .head_memory_limits = self .head_memory
115
139
if self .min_memory :
116
140
warnings .warn ("min_memory is being deprecated, use worker_memory_requests" )
117
141
self .worker_memory_requests = f"{ self .min_memory } G"
0 commit comments