Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .nextchanges/cli/ssh-connect-gpu-accelerator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* `databricks ssh connect --accelerator` now accepts every AI Runtime GPU type the CLI knows, including `GPU_1xH100`, `GPU_8xB300` and `GPU_1xRTX6000`. ([#7833](https://github.com/databricks/cli/pull/7833))
17 changes: 15 additions & 2 deletions cmd/air/compute.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package aircmd
import (
"errors"
"fmt"
"slices"
"strings"
)

Expand All @@ -18,12 +19,24 @@ const (
gpuType1xRTX6000 gpuType = "GPU_1xRTX6000"
)

// KnownGPUTypes lists the accelerator types this CLI accepts, in the order they are shown
// to users. `ssh connect --accelerator` validates against the same list, so the two entry
// points to AI Runtime GPUs agree on the types they offer.
func KnownGPUTypes() []string {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we call AICM's ListComputeOptions to get the list of gpu types available to the user in their workspace? AIR CLI does this already.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When Jobs provisions the SSH session, AICM’s CreateSession already checks whether the workspace can use the requested GPU. Do we really need the check in CLI using one additional RPC call?

return []string{
string(gpuType1xA10),
string(gpuType1xH100),
string(gpuType8xH100),
string(gpuType8xB300),
string(gpuType1xRTX6000),
}
}

// parseGPUType resolves a YAML accelerator_type string to a gpuType. The match is
// exact: the server's lookup is case-sensitive. The error lists no types because
// which ones a workspace can use comes from the server, not this CLI.
func parseGPUType(value string) (gpuType, error) {
switch gpuType(value) {
case gpuType1xA10, gpuType8xH100, gpuType1xH100, gpuType8xB300, gpuType1xRTX6000:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@caroline-db I thought you already removed this list from the CLI client code in favor of the server-side GPU type list. Is this one still used?

if slices.Contains(KnownGPUTypes(), value) {
return gpuType(value), nil
}
return "", fmt.Errorf("%q is not a recognized accelerator type", value)
Expand Down
4 changes: 3 additions & 1 deletion experimental/ssh/cmd/connect.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package ssh

import (
"strings"
"time"

aircmd "github.com/databricks/cli/cmd/air"
"github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/experimental/ssh/internal/client"
"github.com/databricks/cli/libs/cmdctx"
Expand Down Expand Up @@ -71,7 +73,7 @@ Connect to a dedicated cluster:
cmd.Flags().BoolVar(&keepDetachedProcesses, "keep-detached-processes", false, "Keep the SSH server and detached processes (tmux, setsid, nohup) running while detached work remains, bounded by --server-timeout")

cmd.Flags().StringVar(&connectionName, "name", "", "Connection name to reuse across sessions (serverless only)")
cmd.Flags().StringVar(&accelerator, "accelerator", "", "Serverless GPU accelerator type (GPU_1xA10 or GPU_8xH100)")
cmd.Flags().StringVar(&accelerator, "accelerator", "", "Serverless GPU accelerator type ("+strings.Join(aircmd.KnownGPUTypes(), ", ")+")")
cmd.Flags().StringVar(&ide, "ide", "", "Open remote IDE window (vscode or cursor)")
cmd.Flags().StringVar(&usagePolicyID, "usage-policy-id", "", "Usage policy ID for the serverless SSH server job (serverless only)")

Expand Down
7 changes: 5 additions & 2 deletions experimental/ssh/internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ import (
"os/signal"
"path/filepath"
"regexp"
"slices"
"strconv"
"strings"
"syscall"
"time"

aircmd "github.com/databricks/cli/cmd/air"
"github.com/databricks/cli/experimental/ssh/internal/keys"
"github.com/databricks/cli/experimental/ssh/internal/proxy"
"github.com/databricks/cli/experimental/ssh/internal/sshconfig"
Expand Down Expand Up @@ -165,8 +167,9 @@ func (o *ClientOptions) Validate() error {
if o.UsagePolicyID != "" && o.ClusterID != "" {
return errors.New("--usage-policy-id flag can only be used with serverless compute (--name flag)")
}
if o.Accelerator != "" && o.Accelerator != "GPU_1xA10" && o.Accelerator != "GPU_8xH100" {
return fmt.Errorf("invalid accelerator value: %q, expected %q or %q", o.Accelerator, "GPU_1xA10", "GPU_8xH100")
// The same GPU types `databricks air` accepts; the workspace still decides which it offers.
if o.Accelerator != "" && !slices.Contains(aircmd.KnownGPUTypes(), o.Accelerator) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The validation is more nuanced: Not all environment versions work with all GPU types. For example, B300 requires v6+. Can you change the validation here to check each environment-version × accelerator combination?

Even better: move the validation to server side (AI Training) and then we can add more GPU types any time without asking the users to upgrade CLI.

return fmt.Errorf("invalid accelerator value: %q, expected one of %s", o.Accelerator, strings.Join(aircmd.KnownGPUTypes(), ", "))
}
if o.ConnectionName != "" && !connectionNameRegex.MatchString(o.ConnectionName) {
return fmt.Errorf("connection name %q must consist of letters, numbers, dashes, and underscores", o.ConnectionName)
Expand Down
11 changes: 10 additions & 1 deletion experimental/ssh/internal/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,19 @@ func TestValidate(t *testing.T) {
name: "valid connection name with GPU_8xH100 accelerator",
opts: client.ClientOptions{ConnectionName: "my-conn_1", Accelerator: "GPU_8xH100"},
},
{
name: "valid connection name with GPU_1xRTX6000 accelerator",
opts: client.ClientOptions{ConnectionName: "my-conn_1", Accelerator: "GPU_1xRTX6000"},
},
{
name: "well-formed but unknown accelerator value",
opts: client.ClientOptions{ConnectionName: "my-conn", Accelerator: "GPU_2xA10"},
wantErr: `invalid accelerator value: "GPU_2xA10", expected one of GPU_1xA10, GPU_1xH100, GPU_8xH100, GPU_8xB300, GPU_1xRTX6000`,
},
{
name: "invalid accelerator value",
opts: client.ClientOptions{ConnectionName: "my-conn", Accelerator: "CPU_1x"},
wantErr: `invalid accelerator value: "CPU_1x", expected "GPU_1xA10" or "GPU_8xH100"`,
wantErr: `invalid accelerator value: "CPU_1x", expected one of GPU_1xA10, GPU_1xH100, GPU_8xH100, GPU_8xB300, GPU_1xRTX6000`,
},
{
name: "both cluster ID and connection name",
Expand Down
Loading