diff --git a/.nextchanges/air/7587.md b/.nextchanges/air/7587.md new file mode 100644 index 00000000000..b2f040b4a47 --- /dev/null +++ b/.nextchanges/air/7587.md @@ -0,0 +1 @@ +* Show the experiment, accelerators and configuration in the `air list` info pane for runs where it showed `N/A`. ([#7587](https://github.com/databricks/cli/pull/7587)) diff --git a/cmd/air/list_detail.go b/cmd/air/list_detail.go index 59adaf93316..2045bb819d5 100644 --- a/cmd/air/list_detail.go +++ b/cmd/air/list_detail.go @@ -23,6 +23,11 @@ func runDetailText(ctx context.Context, w *databricks.WorkspaceClient, runID int } data := buildGetData(run) + // As in `air get`: an ai_runtime_task run keeps its experiment, accelerators + // and config path on the task. + if genAIComputeTask(run) == nil { + enrichFromAiRuntimeTask(run, &data) + } data.DashboardURL = dashboardURL(w.Config.Host, runID, workspaceIDForRunLink(ctx, w)) ids := mlflowIDs(ctx, w, run) if ids != nil { diff --git a/cmd/air/list_detail_test.go b/cmd/air/list_detail_test.go index 88939b9f363..29813d96300 100644 --- a/cmd/air/list_detail_test.go +++ b/cmd/air/list_detail_test.go @@ -145,3 +145,45 @@ func TestUnnamedOlderRetryLabelFitsTheListColumnAndIsWholeInTheInfoPane(t *testi assert.Equal(t, mlflowColWidth, lipgloss.Width(rows[0].MLflowLabel)) assert.Contains(t, info, mlflowRunID+" (retry 0)") } + +func TestRunDetailTextShowsAiRuntimeTaskFields(t *testing.T) { + // An ai_runtime_task run carries its experiment, accelerators and config + // path on the task, not on a gen_ai_compute_task. + const experiment = "quickstart/qwen-finetune-lora-r16-alpha32-lr2e-4-warmup500-seed42" + run := jobs.Run{RunId: 7, Tasks: []jobs.RunTask{{ + RunId: 70, + AiRuntimeTask: &jobs.AiRuntimeTask{ + Experiment: "/Users/me@example.com/" + experiment, + Deployments: []jobs.DeploymentSpec{{ + CommandPath: "/Workspace/run/command.sh", + Compute: jobs.ComputeSpec{AcceleratorType: jobs.ComputeSpecAcceleratorTypeGpu1xA10, AcceleratorCount: 1}, + }}, + }, + }}} + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case "/api/2.2/jobs/runs/get": + _ = json.NewEncoder(w).Encode(run) + case "/api/2.0/workspace/export": + if r.URL.Query().Get("path") == "/Workspace/run/training_config.yaml" { + _, _ = w.Write([]byte("command: python train.py\n")) + return + } + w.WriteHeader(http.StatusNotFound) + default: + _, _ = w.Write([]byte(`{}`)) + } + })) + t.Cleanup(srv.Close) + ctx := cmdio.MockDiscard(t.Context()) + + info, err := runDetailText(ctx, newTestWorkspaceClient(t, srv.URL), 7) + require.NoError(t, err) + + // The pane shows what the list row and `air get` show, with the experiment + // name whole. + assert.Equal(t, experiment, buildListRow(&run, srv.URL, 0).Experiment) + assert.Contains(t, info, "Experiment "+experiment) + assert.Contains(t, info, "Accelerators 1x A10") + assert.Contains(t, info, "command: python train.py") +}