[air] Add air list/get provisioned_capacity commands - #6595
Conversation
Adds two read commands for pre-provisioned AI Runtime capacity reservations
(the same reservation a run targets via compute.provisioned_capacity_id):
- `air list provisioned_capacity` — the workspace's reservations
(id, accelerator type, reserved accelerators).
- `air get provisioned_capacity <id>` — one reservation plus its accelerator
usage summary (used / idle).
Both call AiWorkflowService's purpose-built public read API
(GET /api/2.0/ai-training/provisioned-capacities[/{id}]) via a raw client.Do,
matching the sibling `air list` workflows call. The platform tracks these
internally as "guaranteed capacity"; the public surface (and this CLI) calls
them "provisioned capacity". Usage is populated only by Get, so the list view
omits it. Output uses the same JSON envelope + text pattern as the other air
commands, and the SAFE-gate the server returns before rollout is surfaced as a
clear FEATURE_DISABLED error rather than a retryable one.
Tests: unit tests for the projections, resource-name handling, int64-as-string
decoding, pagination, and the JSON/text/not-found/feature-disabled paths; an
acceptance test drives the real binary against a mocked endpoint (text + JSON
goldens). Verified live against e2-dogfood: the CLI reaches the deployed
handler and classifies its responses correctly (the API is SAFE-gated off there,
so the successful list/get shape is covered by the goldens).
Co-authored-by: Isaac <no-reply@databricks.com>
Integration test reportCommit: 204b91e
Top 3 slowest tests (at least 2 minutes):
|
- Rename the command from `provisioned_capacity` to `provisioned-capacity`: the repo-wide TestCommandsDontUseUnderscoreInName forbids `_` in a cobra command name (underscore is the command separator in logs). - Replace the pagination loop's index counter with an integer range loop (golangci-lint intrange). - Regenerate the affected acceptance goldens (help + provisioned-capacity). Co-authored-by: Isaac <no-reply@databricks.com>
ben-hansen-db
left a comment
There was a problem hiding this comment.
Some blocking comments, let's align first before merge.
| return nil, fmt.Errorf("failed to create API client: %w", err) | ||
| } | ||
| var pc provisionedCapacity | ||
| if err := apiClient.Do(ctx, http.MethodGet, provisionedCapacityPath+"/"+id, nil, nil, nil, &pc); err != nil { |
There was a problem hiding this comment.
claude:
Both raw workspace calls omit the required workspace routing header. Unified hosts cannot reliably route these requests to Config.WorkspaceID.
There was a problem hiding this comment.
suggests instead
headers := auth.WorkspaceIDHeaders(w.Config)
apiClient.Do(ctx, http.MethodGet, provisionedCapacityPath, headers, nil, query, &resp)
|
|
||
| pc, err := getProvisionedCapacity(ctx, w, id) | ||
| if err != nil { | ||
| if errors.Is(err, apierr.ErrResourceDoesNotExist) { |
There was a problem hiding this comment.
what about other not found errors or http 404?
apierr.ErrNotFound is broader
| databricks experimental air list [command] | ||
|
|
||
| Available Commands: | ||
| provisioned-capacity List the pre-provisioned AI Runtime capacity reservations for the current workspace |
There was a problem hiding this comment.
this is very long... is the the phrase we want to use databricks air list provisioned-capacity??
databricks air list capacity or reservations, pools, commitments
Adds two read commands for pre-provisioned AI Runtime capacity reservations (the same reservation a run targets via compute.provisioned_capacity_id):
air list provisioned_capacity— the workspace's reservations (id, accelerator type, reserved accelerators).air get provisioned_capacity <id>— one reservation plus its accelerator usage summary (used / idle).Both call AiWorkflowService's purpose-built public read API (GET /api/2.0/ai-training/provisioned-capacities[/{id}]) via a raw client.Do, matching the sibling
air listworkflows call. The platform tracks these internally as "guaranteed capacity"; the public surface (and this CLI) calls them "provisioned capacity". Usage is populated only by Get, so the list view omits it. Output uses the same JSON envelope + text pattern as the other air commands, and the SAFE-gate the server returns before rollout is surfaced as a clear FEATURE_DISABLED error rather than a retryable one.Tests: unit tests for the projections, resource-name handling, int64-as-string decoding, pagination, and the JSON/text/not-found/feature-disabled paths; an acceptance test drives the real binary against a mocked endpoint (text + JSON goldens). Verified live against e2-dogfood: the CLI reaches the deployed handler and classifies its responses correctly (the API is SAFE-gated off there, so the successful list/get shape is covered by the goldens).
Changes
Why
Tests
e2e test