@@ -6239,33 +6239,6 @@ def local():
62396239 is_flag = True ,
62406240 help = 'Launch cluster without GPU support even '
62416241 'if GPUs are detected on the host.' )
6242- @click .option (
6243- '--ips' ,
6244- type = str ,
6245- required = False ,
6246- help = 'Path to the file containing IP addresses of remote machines.' )
6247- @click .option ('--ssh-user' ,
6248- type = str ,
6249- required = False ,
6250- help = 'SSH username for accessing remote machines.' )
6251- @click .option ('--ssh-key-path' ,
6252- type = str ,
6253- required = False ,
6254- help = 'Path to the SSH private key.' )
6255- @click .option ('--cleanup' ,
6256- is_flag = True ,
6257- help = 'Clean up the remote cluster instead of deploying it.' )
6258- @click .option (
6259- '--context-name' ,
6260- type = str ,
6261- required = False ,
6262- help = 'Name to use for the kubeconfig context. Defaults to "default". '
6263- 'Used with the ip list.' )
6264- @click .option ('--password' ,
6265- type = str ,
6266- required = False ,
6267- help = 'Password for the ssh-user to execute sudo commands. '
6268- 'Required only if passwordless sudo is not setup.' )
62696242@click .option (
62706243 '--name' ,
62716244 type = str ,
@@ -6282,56 +6255,10 @@ def local():
62826255@flags .config_option (expose_value = False )
62836256@_add_click_options (flags .COMMON_OPTIONS )
62846257@usage_lib .entrypoint
6285- def local_up (gpus : bool , ips : str , ssh_user : str , ssh_key_path : str ,
6286- cleanup : bool , context_name : Optional [str ],
6287- password : Optional [str ], name : Optional [str ],
6288- port_start : Optional [int ], async_call : bool ):
6289- """Creates a local or remote cluster."""
6290-
6291- def _validate_args (ips , ssh_user , ssh_key_path , cleanup ):
6292- # If any of --ips, --ssh-user, or --ssh-key-path is specified,
6293- # all must be specified
6294- if bool (ips ) or bool (ssh_user ) or bool (ssh_key_path ):
6295- if not (ips and ssh_user and ssh_key_path ):
6296- raise click .BadParameter (
6297- 'All --ips, --ssh-user, and --ssh-key-path '
6298- 'must be specified together.' )
6299-
6300- # --cleanup can only be used if --ips, --ssh-user and --ssh-key-path
6301- # are all provided
6302- if cleanup and not (ips and ssh_user and ssh_key_path ):
6303- raise click .BadParameter ('--cleanup can only be used with '
6304- '--ips, --ssh-user and --ssh-key-path.' )
6305-
6306- _validate_args (ips , ssh_user , ssh_key_path , cleanup )
6307-
6308- # If remote deployment arguments are specified, run remote up script
6309- ip_list = None
6310- ssh_key = None
6311- if ips and ssh_user and ssh_key_path :
6312- # Read and validate IP file
6313- try :
6314- with open (os .path .expanduser (ips ), 'r' , encoding = 'utf-8' ) as f :
6315- ip_list = f .read ().strip ().splitlines ()
6316- if not ip_list :
6317- raise click .BadParameter (f'IP file is empty: { ips } ' )
6318- except (IOError , OSError ) as e :
6319- raise click .BadParameter (f'Failed to read IP file { ips } : { str (e )} ' )
6320-
6321- # Read and validate SSH key file
6322- try :
6323- with open (os .path .expanduser (ssh_key_path ), 'r' ,
6324- encoding = 'utf-8' ) as f :
6325- ssh_key = f .read ()
6326- if not ssh_key :
6327- raise click .BadParameter (
6328- f'SSH key file is empty: { ssh_key_path } ' )
6329- except (IOError , OSError ) as e :
6330- raise click .BadParameter (
6331- f'Failed to read SSH key file { ssh_key_path } : { str (e )} ' )
6332-
6333- request_id = sdk .local_up (gpus , ip_list , ssh_user , ssh_key , cleanup ,
6334- context_name , password , name , port_start )
6258+ def local_up (gpus : bool , name : Optional [str ], port_start : Optional [int ],
6259+ async_call : bool ):
6260+ """Creates a local cluster."""
6261+ request_id = sdk .local_up (gpus , name , port_start )
63356262 _async_call_or_wait (request_id , async_call , request_name = 'local up' )
63366263
63376264
@@ -6344,12 +6271,7 @@ def _validate_args(ips, ssh_user, ssh_key_path, cleanup):
63446271@_add_click_options (flags .COMMON_OPTIONS )
63456272@usage_lib .entrypoint
63466273def local_down (name : Optional [str ], async_call : bool ):
6347- """Deletes a local cluster.
6348-
6349- This will only delete a local cluster started without the ip list.
6350- To clean up the local cluster started with a ip list, use `sky local up`
6351- with the cleanup flag.
6352- """
6274+ """Deletes a local cluster."""
63536275 request_id = sdk .local_down (name )
63546276 _async_call_or_wait (request_id , async_call , request_name = 'sky.local.down' )
63556277
0 commit comments