Skip to content

lakebox: add start command, tab completion, fail-fast on unknown sandbox#5308

Open
akshaysingla-db wants to merge 1 commit into
databricks:demo-lakeboxfrom
akshaysingla-db:akshay/lakebox-start-and-completion
Open

lakebox: add start command, tab completion, fail-fast on unknown sandbox#5308
akshaysingla-db wants to merge 1 commit into
databricks:demo-lakeboxfrom
akshaysingla-db:akshay/lakebox-start-and-completion

Conversation

@akshaysingla-db
Copy link
Copy Markdown
Collaborator

Three small additions that close gaps surfaced testing the gateway-host PR end-to-end.

  1. databricks lakebox start <id> — wraps the existing StartSandbox RPC. Symmetric to stop. Useful for pre-warming a sandbox before connecting (the gateway also auto-starts on ssh, so this is mostly for scripting).

  2. Tab completion for sandbox IDs on every command that takes one (ssh / status / stop / start / delete / config / set-default) and key hashes on ssh-key delete. Best-effort: completion silently produces no suggestions when the API call fails so the shell stays usable. Standard Cobra ValidArgsFunction pattern, surfaced via databricks completion bash|zsh|fish like every other Cobra CLI.

  3. databricks lakebox ssh <unknown-id> now fails with no lakebox named "..." — databricks lakebox list shows available IDs instead of falling through to ssh and surfacing Permission denied (publickey) from the gateway. Implemented by making the existing pre-ssh api.get (added in lakebox: read SSH gateway host from Sandbox response, cache per profile #5292 for gateway discovery) treat apierr.ErrNotFound as fatal. Non-NotFound errors still fall through so transient API hiccups don't block a connection the gateway can still route.

Co-authored-by: Isaac

Changes

Why

Tests

Three small additions that close gaps surfaced testing the gateway-host
PR end-to-end.

1. `databricks lakebox start <id>` — wraps the existing StartSandbox
   RPC. Symmetric to `stop`. Useful for pre-warming a sandbox before
   connecting (the gateway also auto-starts on ssh, so this is mostly
   for scripting).

2. Tab completion for sandbox IDs on every command that takes one
   (ssh / status / stop / start / delete / config / set-default) and
   key hashes on `ssh-key delete`. Best-effort: completion silently
   produces no suggestions when the API call fails so the shell stays
   usable. Standard Cobra ValidArgsFunction pattern, surfaced via
   `databricks completion bash|zsh|fish` like every other Cobra CLI.

3. `databricks lakebox ssh <unknown-id>` now fails with
   `no lakebox named "..." — `databricks lakebox list` shows available IDs`
   instead of falling through to ssh and surfacing
   `Permission denied (publickey)` from the gateway. Implemented by
   making the existing pre-ssh `api.get` (added in databricks#5292 for gateway
   discovery) treat `apierr.ErrNotFound` as fatal. Non-NotFound errors
   still fall through so transient API hiccups don't block a
   connection the gateway can still route.

Co-authored-by: Isaac
@github-actions
Copy link
Copy Markdown
Contributor

Waiting for approval

Based on git history, these people are best suited to review:

  • @pietern -- recent work in cmd/lakebox/
  • @shuochen0311 -- recent work in cmd/lakebox/

Eligible reviewers: @andrewnester, @anton-107, @denik, @renaudhartert-db, @shreyas-goenka, @simonfaltum

Suggestions based on git history. See OWNERS for ownership rules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant