Repository navigation
air: Skip purged runs in air list --all-status - #7523
abdulkareem-db wants to merge 2 commits into
Conversation
runs/get reports a purged run as 400 INVALID_PARAMETER_VALUE "Run <id>
does not exist.", which the SDK maps to ErrResourceDoesNotExist.
hydrateJobRuns only dropped 403/404, so one purged run failed the whole
listing. Drop ErrResourceDoesNotExist too, and stop wrapping the error a
second time ("failed to get run X: failed to get run X: ...").
Fixes CNXT-2565.
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
1f8ad07 to
ad3906e
Compare
✅ Integration test reportCommit: ad3906e
Top 6 slowest tests (at least 2 minutes):
|
|
|
||
| // runGetByIDServer serves runs/get per run_id and a stub for the SDK config | ||
| // probe; ids missing from responses return a run with that id. | ||
| func runGetByIDServer(t *testing.T, responses map[string]runGetResponse) *httptest.Server { |
There was a problem hiding this comment.
list_index_test.go already has indexAndGetServer with per-id forbidden/missing maps and TestIndexStrategyDropsForbiddenAndMissing. Can the purged case extend those instead of a second per-id runs/get fake?
| g.Go(func() error { | ||
| run, err := fetchJobRun(gctx, w, id) | ||
| if err != nil { | ||
| if errors.Is(err, apierr.ErrResourceDoesNotExist) { |
There was a problem hiding this comment.
ErrResourceDoesNotExist inherits ErrNotFound, and a plain 404 maps to ErrNotFound too, so errors.Is(err, apierr.ErrNotFound) || errors.Is(err, apierr.ErrPermissionDenied) would replace both branches (precedent: libs/apps/prompt/prompt.go:861). Worth collapsing, or not worth it?
There was a problem hiding this comment.
Correction: APIError.Unwrap resolves error_code before HTTP status, so collapsing to errors.Is would stop dropping a 403/404 that carries a mapped code. Keep the two branches.
Changes
databricks air list --all-statusno longer fails when one of the listed runs has been purged.hydrateJobRunsnow drops runs whoseruns/getcall returnsapierr.ErrResourceDoesNotExist, alongside the existing 403/404 handling, and returns the per-run error without wrapping it a second time.Why
runs/getreports a purged run as400 INVALID_PARAMETER_VALUE"Run does not exist." rather than 404, sohydrateJobRunstreated it as a systemic error and the errgroup failed the whole listing:The Go SDK already maps that response (scoped to
GET /api/2.x/jobs/runs/get) toErrResourceDoesNotExist, so matching the sentinel avoids string-matching the message. Other errors (5xx, otherINVALID_PARAMETER_VALUEresponses, auth) still fail the batch. The doubled "failed to get run" prefix came from wrapping in bothfetchJobRunandhydrateJobRuns; the outer wrap is removed.Tracked internally as CNXT-2565.
Tests
cmd/air/joblist_test.goagainst anhttptestserver (so the SDK's error mapping is exercised): purged (400 "does not exist"), 403 and 404 runs are dropped and the rest keep their order; a 500 and an unrelated 400 still fail with a singlefailed to get run N:prefix. Both tests fail on the previous code.go test ./cmd/air/...andgo test ./acceptance -run TestAccept/air/listpass.This pull request and its description were written by Isaac.