@@ -50,21 +50,25 @@ class Cluster:
50
50
51
51
torchx_scheduler = "ray"
52
52
53
- def __init__ (self , config : ClusterConfiguration ):
53
+ def __init__ (self , config : ClusterConfiguration , generate_app_wrapper : bool = True ):
54
54
"""
55
55
Create the resource cluster object by passing in a ClusterConfiguration
56
56
(defined in the config sub-module). An AppWrapper will then be generated
57
57
based off of the configured resources to represent the desired cluster
58
58
request.
59
59
"""
60
60
self .config = config
61
- self .app_wrapper_yaml = self .create_app_wrapper ()
62
- self .app_wrapper_name = self .app_wrapper_yaml .split ("." )[0 ]
61
+ self .app_wrapper_yaml = None
62
+ self .app_wrapper_name = None
63
+
64
+ if generate_app_wrapper :
65
+ self .app_wrapper_yaml = self .create_app_wrapper ()
66
+ self .app_wrapper_name = self .app_wrapper_yaml .split ("." )[0 ]
63
67
64
68
def create_app_wrapper (self ):
65
69
"""
66
- Called upon cluster object creation, creates an AppWrapper yaml based on
67
- the specifications of the ClusterConfiguration.
70
+ Called upon cluster object creation if generate_app_wrapper is True , creates an AppWrapper yaml
71
+ based on the specifications of the ClusterConfiguration.
68
72
"""
69
73
70
74
if self .config .namespace is None :
@@ -115,6 +119,9 @@ def up(self):
115
119
Applies the AppWrapper yaml, pushing the resource request onto
116
120
the MCAD queue.
117
121
"""
122
+ if self .app_wrapper_yaml is None :
123
+ print ("Error putting up RayCluster: AppWrapper yaml not generated" )
124
+ return
118
125
namespace = self .config .namespace
119
126
try :
120
127
config_check ()
@@ -145,7 +152,7 @@ def down(self):
145
152
version = "v1beta1" ,
146
153
namespace = namespace ,
147
154
plural = "appwrappers" ,
148
- name = self .app_wrapper_name ,
155
+ name = self .config . name ,
149
156
)
150
157
except Exception as e : # pragma: no cover
151
158
return _kube_api_error_handling (e )
@@ -346,7 +353,7 @@ def from_k8_cluster_object(rc):
346
353
]["image" ],
347
354
local_interactive = local_interactive ,
348
355
)
349
- return Cluster (cluster_config )
356
+ return Cluster (cluster_config , False )
350
357
351
358
def from_definition_yaml (yaml_path ):
352
359
try :
0 commit comments