Skip to content

Commit

Permalink
Check cluster exists
Browse files Browse the repository at this point in the history
  • Loading branch information
colinjc committed Jul 23, 2024
1 parent a76a356 commit 4a53763
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sky/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5260,9 +5260,14 @@ def code(
if not cluster:
raise click.UsageError('Please specify a cluster with ---cluster/-c.')

handle = global_user_state.get_handle_from_cluster_name(cluster)
if handle is None:
raise click.BadParameter(f'Cluster {cluster!r} not found. '
'Use `sky launch` to provision first.')

code_bin = shutil.which("code")
if not code_bin:
raise RuntimeError(
raise click.UsageError(
'"code" is not available in your path. Ensure VSCode in installed and the shell command is available on '
'your path https://code.visualstudio.com/docs/setup/mac#_launching-from-the-command-line'
)
Expand Down

0 comments on commit 4a53763

Please sign in to comment.