-
Notifications
You must be signed in to change notification settings - Fork 199
AIR CLI Integration: authenticate air get up front and fail fast
#5729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
3dab193
experimental/air: authenticate `air get` up front and fail fast
riddhibhagwat-db 5d0feb4
experimental/air: render `air get` config and metadata for ai_runtime…
riddhibhagwat-db 3eabc54
experimental/air: address `air get` review feedback
riddhibhagwat-db 00be4b2
experimental/air: yamlfmt the get-ai-runtime training config
riddhibhagwat-db File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
|
|
||
| === get (text) | ||
| >>> [CLI] experimental air get 123 | ||
|
|
||
| ╭─ Configuration ────────────────────────────────────────────────╮ | ||
| │ │ | ||
| │ experiment_name: my-exp │ | ||
| │ compute: │ | ||
| │ accelerator_type: a10 │ | ||
| │ num_accelerators: 1 │ | ||
| │ command: |- │ | ||
| │ for i in $(seq 1 10); do │ | ||
| │ echo "step $i" │ | ||
| │ done │ | ||
| │ │ | ||
| ╰────────────────────────────────────────────────────────────────╯ | ||
|
|
||
| ╭─ Metadata ─────────────────────────────────────────────────────╮ | ||
| │ │ | ||
| │ Run ID 123 │ | ||
| │ Status ● SUCCESS │ | ||
| │ Submitted 2023-11-14 22:13 UTC │ | ||
| │ Retries 0 │ | ||
| │ Max Retries 3 │ | ||
| │ Duration 12s │ | ||
| │ Experiment my-exp │ | ||
| │ MLflow Run my-run │ | ||
| │ User user@example.com │ | ||
| │ Accelerators 1x A10 │ | ||
| │ Environment N/A │ | ||
| │ │ | ||
| ╰────────────────────────────────────────────────────────────────╯ | ||
|
|
||
| Run URL: [DATABRICKS_URL]/jobs/runs/123?o=[NUMID] | ||
| MLflow URL: [DATABRICKS_URL]/ml/experiments/exp1/runs/run1 | ||
|
|
||
| === get (json) | ||
| >>> [CLI] experimental air get 123 -o json | ||
| { | ||
| "v": 1, | ||
| "ts": "[TIMESTAMP]", | ||
| "data": { | ||
| "run_id": "123", | ||
| "status": "SUCCESS", | ||
| "started_at": "[TIMESTAMP]", | ||
| "duration_seconds": 12, | ||
| "attempt_number": 0, | ||
| "experiment_name": "my-exp", | ||
| "dashboard_url": "[DATABRICKS_URL]/jobs/runs/123?o=[NUMID]", | ||
| "mlflow_url": "[DATABRICKS_URL]/ml/experiments/exp1/runs/run1/artifacts/logs/node_0" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # Seed the run's training_config.yaml next to command.sh so `air get` can | ||
| # download and render it in the Configuration box. | ||
| $CLI workspace import "/Workspace/Users/user@example.com/.air/cli_launch/my-exp/my-exp_abc/training_config.yaml" --file training_config.yaml --format AUTO &> LOG.import | ||
|
|
||
| title "get (text)" | ||
| trace $CLI experimental air get 123 | ||
|
|
||
| title "get (json)" | ||
| trace $CLI experimental air get 123 -o json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # This command does not deploy a bundle, so no engine matrix is needed. | ||
| [EnvMatrix] | ||
| DATABRICKS_BUNDLE_ENGINE = [] | ||
|
|
||
| # The SDK occasionally probes host reachability with a HEAD request; stub it so | ||
| # the test is deterministic. | ||
| [[Server]] | ||
| Pattern = "HEAD /" | ||
| Response.Body = '' | ||
|
|
||
| # The typed SDK GetRun response: an ai_runtime_task run has no gen_ai_compute_task, | ||
| # so the task comes back empty (the SDK has no field for ai_runtime_task). | ||
| [[Server]] | ||
| Pattern = "GET /api/2.2/jobs/runs/get" | ||
| Response.Body = ''' | ||
| { | ||
| "run_id": 123, | ||
| "run_page_url": "https://my-workspace.cloud.databricks.test/jobs/runs/123", | ||
| "creator_user_name": "user@example.com", | ||
| "start_time": 1700000000000, | ||
| "end_time": 1700000012000, | ||
| "state": {"life_cycle_state": "TERMINATED", "result_state": "SUCCESS"}, | ||
| "tasks": [ | ||
| { | ||
| "task_key": "train", | ||
| "run_id": 456, | ||
| "attempt_number": 0, | ||
| "max_retries": 3, | ||
| "ai_runtime_task": { | ||
| "experiment": "my-exp", | ||
| "deployments": [ | ||
| { | ||
| "command_path": "/Workspace/Users/user@example.com/.air/cli_launch/my-exp/my-exp_abc/command.sh", | ||
| "compute": {"accelerator_type": "GPU_1xA10", "accelerator_count": 1} | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| ''' | ||
|
|
||
| # MLflow identifiers for the deep-link (runs/get-output is not modeled by the typed SDK). | ||
| [[Server]] | ||
| Pattern = "GET /api/2.2/jobs/runs/get-output" | ||
| Response.Body = ''' | ||
| {"gen_ai_compute_output": {"run_info": {"mlflow_experiment_id": "exp1", "mlflow_run_id": "run1"}}} | ||
| ''' | ||
|
|
||
| # The MLflow Run cell shows the run's name, fetched from the MLflow REST API. | ||
| [[Server]] | ||
| Pattern = "GET /api/2.0/mlflow/runs/get" | ||
| Response.Body = ''' | ||
| {"run": {"info": {"run_name": "my-run"}}} | ||
| ''' |
8 changes: 8 additions & 0 deletions
8
acceptance/experimental/air/get-ai-runtime/training_config.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| experiment_name: my-exp | ||
| compute: | ||
| accelerator_type: a10 | ||
| num_accelerators: 1 | ||
| command: |- | ||
| for i in $(seq 1 10); do | ||
| echo "step $i" | ||
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any failure from this Me() probe is routed through authError, which unconditionally emits UNAUTHENTICATED / PERMANENT / retryable=false (L82–87). So a transient failure reaching /me (429, 5xx, network blip) gets reported as a non-retryable auth error.
Consider only mapping to UNAUTHENTICATED when the error is actually authshaped (e.g. an apierr 401/403), and falling back to the transient classification otherwise.