@@ -201,13 +201,28 @@ def down(self):
201
201
try :
202
202
config_check ()
203
203
api_instance = client .CustomObjectsApi (api_config_handler ())
204
- api_instance .delete_namespaced_custom_object (
205
- group = "workload.codeflare.dev" ,
206
- version = "v1beta1" ,
207
- namespace = namespace ,
208
- plural = "appwrappers" ,
209
- name = self .app_wrapper_name ,
210
- )
204
+ if self .config .mcad :
205
+ api_instance .delete_namespaced_custom_object (
206
+ group = "workload.codeflare.dev" ,
207
+ version = "v1beta1" ,
208
+ namespace = namespace ,
209
+ plural = "appwrappers" ,
210
+ name = self .app_wrapper_name ,
211
+ )
212
+ else :
213
+ with open (self .app_wrapper_yaml ) as f :
214
+ yamls = yaml .load_all (f , Loader = yaml .FullLoader )
215
+ for resource in yamls :
216
+ if resource ["kind" ] == "RayCluster" :
217
+ api_instance .delete_namespaced_custom_object (
218
+ group = "ray.io" ,
219
+ version = "v1alpha1" ,
220
+ namespace = namespace ,
221
+ plural = "rayclusters" ,
222
+ name = self .app_wrapper_name ,
223
+ )
224
+ else :
225
+ print (resource ["kind" ])
211
226
except Exception as e : # pragma: no cover
212
227
return _kube_api_error_handling (e )
213
228
@@ -220,38 +235,39 @@ def status(
220
235
"""
221
236
ready = False
222
237
status = CodeFlareClusterStatus .UNKNOWN
223
- # check the app wrapper status
224
- appwrapper = _app_wrapper_status (self .config .name , self .config .namespace )
225
- if appwrapper :
226
- if appwrapper .status in [
227
- AppWrapperStatus .RUNNING ,
228
- AppWrapperStatus .COMPLETED ,
229
- AppWrapperStatus .RUNNING_HOLD_COMPLETION ,
230
- ]:
231
- ready = False
232
- status = CodeFlareClusterStatus .STARTING
233
- elif appwrapper .status in [
234
- AppWrapperStatus .FAILED ,
235
- AppWrapperStatus .DELETED ,
236
- ]:
237
- ready = False
238
- status = CodeFlareClusterStatus .FAILED # should deleted be separate
239
- return status , ready # exit early, no need to check ray status
240
- elif appwrapper .status in [
241
- AppWrapperStatus .PENDING ,
242
- AppWrapperStatus .QUEUEING ,
243
- ]:
244
- ready = False
245
- if appwrapper .status == AppWrapperStatus .PENDING :
246
- status = CodeFlareClusterStatus .QUEUED
247
- else :
248
- status = CodeFlareClusterStatus .QUEUEING
249
- if print_to_console :
250
- pretty_print .print_app_wrappers_status ([appwrapper ])
251
- return (
252
- status ,
253
- ready ,
254
- ) # no need to check the ray status since still in queue
238
+ if self .config .mcad :
239
+ # check the app wrapper status
240
+ appwrapper = _app_wrapper_status (self .config .name , self .config .namespace )
241
+ if appwrapper :
242
+ if appwrapper .status in [
243
+ AppWrapperStatus .RUNNING ,
244
+ AppWrapperStatus .COMPLETED ,
245
+ AppWrapperStatus .RUNNING_HOLD_COMPLETION ,
246
+ ]:
247
+ ready = False
248
+ status = CodeFlareClusterStatus .STARTING
249
+ elif appwrapper .status in [
250
+ AppWrapperStatus .FAILED ,
251
+ AppWrapperStatus .DELETED ,
252
+ ]:
253
+ ready = False
254
+ status = CodeFlareClusterStatus .FAILED # should deleted be separate
255
+ return status , ready # exit early, no need to check ray status
256
+ elif appwrapper .status in [
257
+ AppWrapperStatus .PENDING ,
258
+ AppWrapperStatus .QUEUEING ,
259
+ ]:
260
+ ready = False
261
+ if appwrapper .status == AppWrapperStatus .PENDING :
262
+ status = CodeFlareClusterStatus .QUEUED
263
+ else :
264
+ status = CodeFlareClusterStatus .QUEUEING
265
+ if print_to_console :
266
+ pretty_print .print_app_wrappers_status ([appwrapper ])
267
+ return (
268
+ status ,
269
+ ready ,
270
+ ) # no need to check the ray status since still in queue
255
271
256
272
# check the ray cluster status
257
273
cluster = _ray_cluster_status (self .config .name , self .config .namespace )
0 commit comments