@@ -310,21 +310,34 @@ def ondemand_cluster(
310
310
>>> # Load cluster from above
311
311
>>> reloaded_cluster = rh.ondemand_cluster(name="rh-4-a100s")
312
312
"""
313
- launcher = launcher .lower () if launcher else configs .launcher
314
- if launcher not in LauncherType .strings ():
315
- raise ValueError (
316
- f"Invalid launcher type '{ launcher } '. Must be one of { LauncherType .strings ()} ."
317
- )
313
+ cluster_args = locals ().copy ()
314
+ cluster_args = {k : v for k , v in cluster_args .items () if v is not None }
315
+
316
+ if pool is not None :
317
+ cluster_args ["launcher" ] = "den"
318
+ ignored_fields = {"provider" , "region" , "vpc_name" }
319
+ for field in ignored_fields :
320
+ if cluster_args .get (field ):
321
+ logger .warning (f"Ignoring '{ field } ' argument when pool is provided" )
322
+ cluster_args .pop (field , None )
323
+ if autostop_mins != - 1 :
324
+ logger .warning (
325
+ "Setting autostop on compute launched in a pool is not recommended and will be deprecated."
326
+ )
327
+ else :
328
+ launcher = launcher .lower () if launcher else configs .launcher
329
+ if launcher not in LauncherType .strings ():
330
+ raise ValueError (
331
+ f"Invalid launcher type '{ launcher } '. Must be one of { LauncherType .strings ()} ."
332
+ )
318
333
319
- if vpc_name and launcher == "local" :
334
+ if vpc_name and launcher and launcher == "local" :
320
335
raise ValueError (
321
336
"Custom VPCs are not supported with local launching. To use a custom VPC, please use the "
322
337
"Den launcher. For more information see "
323
338
"https://www.run.house/docs/installation-setup#den-launcher"
324
339
)
325
340
326
- cluster_args = locals ().copy ()
327
- cluster_args = {k : v for k , v in cluster_args .items () if v is not None }
328
341
if "accelerators" in cluster_args :
329
342
logger .warning (
330
343
"``accelerators`` argument has been deprecated. Please use ``gpus`` argument instead."
0 commit comments