diff --git a/.nextchanges/air/mlflow-logs-page.md b/.nextchanges/air/mlflow-logs-page.md new file mode 100644 index 00000000000..53333511b43 --- /dev/null +++ b/.nextchanges/air/mlflow-logs-page.md @@ -0,0 +1 @@ +* Route AIR log links to the MLflow Logs page instead of the hidden artifact path. ([#7491](https://github.com/databricks/cli/pull/7491)) diff --git a/acceptance/air/get-ai-runtime/output.txt b/acceptance/air/get-ai-runtime/output.txt index 0485ab36852..c84683e3f3e 100644 --- a/acceptance/air/get-ai-runtime/output.txt +++ b/acceptance/air/get-ai-runtime/output.txt @@ -49,7 +49,7 @@ MLflow URL: [DATABRICKS_URL]/ml/experiments/exp1/runs/run1 "attempt_number": 0, "experiment_name": "my-exp", "dashboard_url": "[DATABRICKS_URL]/jobs/runs/123?o=[WORKSPACE_ID]", - "mlflow_url": "[DATABRICKS_URL]/ml/experiments/exp1/runs/run1/artifacts/logs/node_0", + "mlflow_url": "[DATABRICKS_URL]/ml/experiments/exp1/runs/run1/logs", "est_remaining_seconds": null, "est_percent_complete": null } diff --git a/acceptance/air/get/output.txt b/acceptance/air/get/output.txt index df8398a83d0..9c1fed61721 100644 --- a/acceptance/air/get/output.txt +++ b/acceptance/air/get/output.txt @@ -49,7 +49,7 @@ MLflow URL: [DATABRICKS_URL]/ml/experiments/exp1/runs/run1 "attempt_number": 0, "experiment_name": "my-exp", "dashboard_url": "[DATABRICKS_URL]/jobs/runs/123?o=[WORKSPACE_ID]", - "mlflow_url": "[DATABRICKS_URL]/ml/experiments/exp1/runs/run1/artifacts/logs/node_0", + "mlflow_url": "[DATABRICKS_URL]/ml/experiments/exp1/runs/run1/logs", "est_remaining_seconds": null, "est_percent_complete": null } diff --git a/cmd/air/list_cache_test.go b/cmd/air/list_cache_test.go index 820b7d1718f..afeb2a2e490 100644 --- a/cmd/air/list_cache_test.go +++ b/cmd/air/list_cache_test.go @@ -154,6 +154,7 @@ func TestIndexStrategyCachesMLflowEnrichment(t *testing.T) { require.NoError(t, err) require.Len(t, rows, 1) assert.Equal(t, "training-run", rows[0].MLflowLabel) + assert.Equal(t, srv.URL+"/ml/experiments/exp1/runs/mlflow1/logs", rows[0].MLflowURL) } assert.Equal(t, 1, getHits, "warm cache must skip runs/get") diff --git a/cmd/air/list_tui_test.go b/cmd/air/list_tui_test.go index 583cc570c07..975371b7e8d 100644 --- a/cmd/air/list_tui_test.go +++ b/cmd/air/list_tui_test.go @@ -7,6 +7,7 @@ import ( tea "github.com/charmbracelet/bubbletea" "github.com/databricks/cli/libs/cmdio" + "github.com/databricks/cli/libs/env" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -15,7 +16,7 @@ import ( // absent MLflow link, and a still-running (no end) row. func testListRows() []listRow { return []listRow{ - {RunID: "1", Experiment: "qwen-train", User: "me@example.com", Status: "SUCCESS", StartedAt: new("2026-06-05T17:32:39.000000+00:00"), Duration: "1m 14s", MLflowURL: "https://h/ml/experiments/E/runs/04c41514fbb0/artifacts/logs/node_0", MLflowLabel: "qwen-run-001", Accelerators: "8x H100"}, + {RunID: "1", Experiment: "qwen-train", User: "me@example.com", Status: "SUCCESS", StartedAt: new("2026-06-05T17:32:39.000000+00:00"), Duration: "1m 14s", MLflowURL: "https://h/ml/experiments/E/runs/04c41514fbb0/logs", MLflowLabel: "qwen-run-001", Accelerators: "8x H100"}, {RunID: "2", Experiment: "llama-train", User: "me@example.com", Status: "RUNNING", StartedAt: new("2026-06-05T18:43:24.000000+00:00"), Duration: "3m 32s", Progress: "81% ยท ~48m", MLflowURL: "-", MLflowLabel: "-", Accelerators: "1x A10"}, {RunID: "3", Experiment: "mixtral", User: "me@example.com", Status: "FAILED", StartedAt: nil, Duration: "-", MLflowURL: "-", MLflowLabel: "-", Accelerators: "-"}, } @@ -152,6 +153,21 @@ func TestListModelQuit(t *testing.T) { assert.Equal(t, tea.QuitMsg{}, cmd()) } +func TestListModelEnterOpensMLflowLogs(t *testing.T) { + ctx, stderr := cmdio.NewTestContextWithStderr(t.Context()) + ctx = env.Set(ctx, "BROWSER", "none") + r, _ := cmdio.NewRenderer(ctx, io.Discard) + f := &runFetcher{ctx: ctx, w: newTestWorkspaceClient(t, "https://x.test")} + m := newListModel(r, f, testListRows(), false) + + _, cmd := m.Update(tea.KeyMsg{Type: tea.KeyEnter}) + require.NotNil(t, cmd) + cmd() + + assert.Contains(t, stderr.String(), "https://h/ml/experiments/E/runs/04c41514fbb0/logs") + assert.NotContains(t, stderr.String(), "/artifacts/logs/node_0") +} + func TestListModelView(t *testing.T) { next, _ := testListModel(t).Update(tea.WindowSizeMsg{Width: 200, Height: 24}) out := next.(listModel).View() diff --git a/cmd/air/mlflow.go b/cmd/air/mlflow.go index 5434142a3c8..3e00ebf7492 100644 --- a/cmd/air/mlflow.go +++ b/cmd/air/mlflow.go @@ -59,11 +59,10 @@ func mlflowIDsFromOutput(output *jobs.AiRuntimeTaskOutput) *mlflowIdentifiers { return &mlflowIdentifiers{ExperimentID: output.MlflowExperimentId, RunID: output.MlflowRunId} } -// mlflowLogsURL is the deep link to a run's node-0 logs. It is the value of the -// JSON `mlflow_url` field, matching the Python CLI. +// mlflowLogsURL links to a run's Logs tab. It is also the value of the JSON +// `mlflow_url` field. func mlflowLogsURL(host string, ids *mlflowIdentifiers) string { - return fmt.Sprintf("%s/ml/experiments/%s/runs/%s/artifacts/logs/node_0", - strings.TrimRight(host, "/"), ids.ExperimentID, ids.RunID) + return mlflowRunURL(host, ids) + "/logs" } // mlflowRunURL links to the MLflow run page; it backs the MLflow Run hyperlink diff --git a/cmd/air/mlflow_test.go b/cmd/air/mlflow_test.go index a3dd5376298..b72f7a928b3 100644 --- a/cmd/air/mlflow_test.go +++ b/cmd/air/mlflow_test.go @@ -110,7 +110,7 @@ func TestMLflowIDsForTask(t *testing.T) { func TestMLflowURLs(t *testing.T) { ids := &mlflowIdentifiers{ExperimentID: "E1", RunID: "R1"} // A trailing slash on the host must not produce a double slash in the link. - assert.Equal(t, "https://h.test/ml/experiments/E1/runs/R1/artifacts/logs/node_0", mlflowLogsURL("https://h.test/", ids)) + assert.Equal(t, "https://h.test/ml/experiments/E1/runs/R1/logs", mlflowLogsURL("https://h.test/", ids)) assert.Equal(t, "https://h.test/ml/experiments/E1/runs/R1", mlflowRunURL("https://h.test", ids)) }