File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -232,9 +232,16 @@ def initialize_ray_cluster(
232
232
233
233
# Connect to a ray cluster.
234
234
if current_platform .is_rocm () or current_platform .is_xpu ():
235
- ray .init (address = ray_address ,
236
- ignore_reinit_error = True ,
237
- num_gpus = parallel_config .world_size )
235
+ # Try to connect existing ray instance and create a new one if not found
236
+ try :
237
+ ray .init ("auto" )
238
+ except ConnectionError :
239
+ logger .warning (
240
+ "No existing RAY instance detected. "
241
+ "A new instance will be launched with current node resources." )
242
+ ray .init (address = ray_address ,
243
+ ignore_reinit_error = True ,
244
+ num_gpus = parallel_config .world_size )
238
245
else :
239
246
ray .init (address = ray_address , ignore_reinit_error = True )
240
247
You can’t perform that action at this time.
0 commit comments