Skip to content
Merged
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/air/accelerator-field-compute-help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Show workspace-supported accelerator types in `databricks air run -h config.compute.accelerator_type`. ([#7275](https://github.com/databricks/cli/pull/7275))
7 changes: 6 additions & 1 deletion acceptance/air/config-help/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ config.compute
Which accelerators to run on and how many.

Supported accelerator types:
GPU_1xH100 - 1 accelerator per node [Private Preview]
GPU_1xH100 - 1 accelerator per node
GPU_8xH100 - 8 accelerators per node
GPU_1xRTX6000 - 1 accelerator per node

Expand Down Expand Up @@ -128,6 +128,11 @@ config.environment.version
config.compute.accelerator_type
Which accelerator to run on, e.g. GPU_1xA10. See https://docs.databricks.com/aws/en/machine-learning/ai-runtime/cli/yaml-config#reference for the current list of supported GPU types. Matched case-sensitively.

Supported accelerator types:
GPU_1xH100 - 1 accelerator per node
GPU_8xH100 - 8 accelerators per node
GPU_1xRTX6000 - 1 accelerator per node

Type: string
Required: no

Expand Down
2 changes: 1 addition & 1 deletion acceptance/air/config-help/test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Pattern = "GET /api/2.0/ai-training/compute-options"
Response.Body = '''
{
"compute_options": [
{"hardware_accelerator": "GPU_1xH100", "per_node_accelerator_count": 1, "launch_stage": "PRIVATE_PREVIEW"},
{"hardware_accelerator": "GPU_1xH100", "per_node_accelerator_count": 1, "launch_stage": "GA"},
{"hardware_accelerator": "GPU_8xH100", "per_node_accelerator_count": 8, "launch_stage": "GA"},
{"hardware_accelerator": "GPU_1xRTX6000", "per_node_accelerator_count": 1, "launch_stage": "GA"}
]
Expand Down
2 changes: 1 addition & 1 deletion cmd/air/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ The path must be a separate argument: cobra reserves -h as a boolean, so
}

var computeOptions []computeOption
if field.path == "config.compute" {
if field.path == "config.compute" || field.path == "config.compute.accelerator_type" {
computeOptions = loadComputeOptionsForHelp(c, args)
}
renderConfigField(c.OutOrStdout(), field, computeOptions)
Expand Down
2 changes: 1 addition & 1 deletion cmd/air/runconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ func renderConfigField(w io.Writer, f configField, computeOptions []computeOptio
if f.help != "" {
fmt.Fprintf(w, " %s\n", f.help)
}
if f.path == "config.compute" && computeOptions != nil {
if (f.path == "config.compute" || f.path == "config.compute.accelerator_type") && computeOptions != nil {
fmt.Fprintln(w, "\n Supported accelerator types:")
if len(computeOptions) == 0 {
fmt.Fprintln(w, " No accelerator types are currently available for AI Runtime in this workspace.")
Expand Down
7 changes: 7 additions & 0 deletions cmd/air/runconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -984,12 +984,19 @@ func TestRunCommandHelp_NoConfigPath(t *testing.T) {
// -h with a config path documents the field instead of the command, and does so
// without the otherwise-required --file.
func TestRunCommandHelp_ConfigPath(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
_, _ = w.Write([]byte(`{"compute_options":[{"hardware_accelerator":"GPU_FUTURE","per_node_accelerator_count":16}]}`))
}))
t.Cleanup(srv.Close)

var out strings.Builder
cmd := newRunCommand()
cmd.SetContext(cmdctx.SetWorkspaceClient(t.Context(), newTestWorkspaceClient(t, srv.URL)))
cmd.SetOut(&out)
cmd.SetArgs([]string{"-h", "config.compute.accelerator_type"})
require.NoError(t, cmd.Execute())
assert.Contains(t, out.String(), "config.compute.accelerator_type")
assert.Contains(t, out.String(), "GPU_FUTURE - 16 accelerators per node")
assert.Contains(t, out.String(), "Type: string")
assert.NotContains(t, out.String(), "Usage:")
}
Expand Down
Loading