Skip to content

air run: git-pin code_source snapshots#6016

Open
vinchenzo-db wants to merge 1 commit into
air-cli-tar-snapshotfrom
air-cli-git-pinning
Open

air run: git-pin code_source snapshots#6016
vinchenzo-db wants to merge 1 commit into
air-cli-tar-snapshotfrom
air-cli-git-pinning

Conversation

@vinchenzo-db

@vinchenzo-db vinchenzo-db commented Jul 21, 2026

Copy link
Copy Markdown

Add git pinning to the CLI code_source snapshot path: when code_source.snapshot.git sets a commit or branch, resolve it locally and git archive that commit into the tarball (instead of plain-tarring the working tree), then upload it through the same DABs artifact plumbing as the tar path.

buildSnapshotTarball now resolves a snapshotPlan (resolveSnapshotPlan) and uses createGitArchiveSnapshot for the git_archive mode. Reintroduces the git helpers (snapshot_git.go, snapshot_resolve.go, snapshot_cachekey.go) removed in the tar PR.

Git resolution stays CLI-side (it is a train.yaml construct with no DABs config surface); only the tarball upload reuses DABs plumbing.

Co-authored-by: Isaac

Changes

Why

Tests

Before:
image

After:
image

# v.chen at ip-10-90-29-234 in ~/databricks-cli (git:air-cli-git-pinning) [19:09:56]
$ cd /home/v.chen/databricks-cli
go build -o /tmp/dbcli-air ./main.go
# v.chen at ip-10-90-29-234 in ~/databricks-cli (git:air-cli-git-pinning) [19:10:32]
$ rm -rf /tmp/air-e2e && mkdir -p /tmp/air-e2e/src
cat > /tmp/air-e2e/src/train.py <<'PY'
import os
print("cwd:", os.getcwd(), "CODE_SOURCE_PATH:", os.environ.get("CODE_SOURCE_PATH"))
PY
cat > /tmp/air-e2e/train.yaml <<'YAML'
experiment_name: vchen_clistack_e2e
command: cd $CODE_SOURCE_PATH && python train.py
compute:
  accelerator_type: GPU_1xA10
  num_accelerators: 1
environment:
  version: "4"
  dependencies: []
code_source:
  type: snapshot
  snapshot:
    root_path: src
YAML

Submit:
Before:

/tmp/dbcli-after  experimental air run -f train.yaml -p dbc-04ac0685-8857
Uploading src.tar.gz...
Submitted run 904299656690242
View at: https://dbc-04ac0685-8857.staging.cloud.databricks.com/jobs/runs/904299656690242

After:

# v.chen at ip-10-90-29-234 in ~/databricks-cli (git:air-cli-git-pinning) [19:10:41]
$ cd /tmp/air-e2e
/tmp/dbcli-air experimental air run -f train.yaml -p dbc-04ac0685-8857
Uploading src.tar.gz...
Submitted run 282829443240803
View at: https://dbc-04ac0685-8857.staging.cloud.databricks.com/jobs/runs/282829443240803

Get:
Before:

$ /tmp/dbcli-after  experimental air get 904299656690242 -p dbc-04ac0685-8857

╭─ Configuration ────────────────────────────────────────────────╮
│                                                                │
│  experiment_name: vchen_dabs_demo                              │
│  command: cd $CODE_SOURCE_PATH && python train.py              │
│  compute:                                                      │
│    accelerator_type: GPU_1xA10                                 │
│    num_accelerators: 1                                         │
│  environment:                                                  │
│    version: "4"                                                │
│    dependencies: []                                            │
│  code_source:                                                  │
│    type: snapshot                                              │
│    snapshot:                                                   │
│      root_path: src                                            │
│                                                                │
╰────────────────────────────────────────────────────────────────╯

╭─ Metadata ─────────────────────────────────────────────────────╮
│                                                                │
│  Run ID        904299656690242                                 │
│  Status        ● SUCCESS                                       │
│  Submitted     2026-07-21 21:27 UTC                            │
│  Retries       0                                               │
│  Max Retries   0                                               │
│  Duration      1m 12s                                          │
│  Experiment    vchen_dabs_demo                                 │
│  MLflow Run    vchen_dabs_demo-175605453903229                 │
│  User          v.chen@databricks.com                           │
│  Accelerators  1x A10                                          │
│  Environment   N/A                                             │
│                                                                │
╰────────────────────────────────────────────────────────────────╯

Run URL:    https://dbc-04ac0685-8857.staging.cloud.databricks.com/jobs/runs/904299656690242?o=3360802220363900
MLflow URL: https://dbc-04ac0685-8857.staging.cloud.databricks.com/ml/experiments/4433704631456901/runs/533d7ad6775540ed8fcf771029bb0b54

After:

# v.chen at ip-10-90-29-234 in /tmp/air-e2e (git:) [19:10:58]
$ /tmp/dbcli-air workspace list /Workspace/Users/v.chen@databricks.com/.air/repo_snapshots/.internal -p dbc-04ac0685-8857
ID                Type  Language  Path
4370802146211389  FILE            /Workspace/Users/v.chen@databricks.com/.air/repo_snapshots/.internal/src.tar.gz
# v.chen at ip-10-90-29-234 in /tmp/air-e2e (git:) [19:15:46]
$ /tmp/dbcli-air experimental air get 282829443240803 -p dbc-04ac0685-8857

╭─ Configuration ────────────────────────────────────────────────╮
│                                                                │
│  experiment_name: vchen_clistack_e2e                           │
│  command: cd $CODE_SOURCE_PATH && python train.py              │
│  compute:                                                      │
│    accelerator_type: GPU_1xA10                                 │
│    num_accelerators: 1                                         │
│  environment:                                                  │
│    version: "4"                                                │
│    dependencies: []                                            │
│  code_source:                                                  │
│    type: snapshot                                              │
│    snapshot:                                                   │
│      root_path: src                                            │
│                                                                │
╰────────────────────────────────────────────────────────────────╯

╭─ Metadata ─────────────────────────────────────────────────────╮
│                                                                │
│  Run ID        282829443240803                                 │
│  Status        ● SUCCESS                                       │
│  Submitted     2026-07-21 19:10 UTC                            │
│  Retries       0                                               │
│  Max Retries   0                                               │
│  Duration      1m 22s                                          │
│  Experiment    vchen_clistack_e2e                              │
│  MLflow Run    vchen_clistack_e2e-350226244858021              │
│  User          v.chen@databricks.com                           │
│  Accelerators  1x A10                                          │
│  Environment   N/A                                             │
│                                                                │
╰────────────────────────────────────────────────────────────────╯

Run URL:    https://dbc-04ac0685-8857.staging.cloud.databricks.com/jobs/runs/282829443240803?o=3360802220363900
MLflow URL: https://dbc-04ac0685-8857.staging.cloud.databricks.com/ml/experiments/4370802146211390/runs/6e7fcbb599764aab8fd1f0a050ca6860
# v.chen at ip-10-90-29-234 in /tmp/air-e2e (git:) [19:16:29]
$ 
image ^ asked claude to make a dummy repo, make an empty commit, add some uncommited txt files, and check that the snapshot does not contain the txt file

Add git pinning to the CLI code_source snapshot path: when
code_source.snapshot.git sets a commit or branch, resolve it locally and
`git archive` that commit into the tarball (instead of plain-tarring the working
tree), then upload it through the same DABs artifact plumbing as the tar path.

buildSnapshotTarball now resolves a snapshotPlan (resolveSnapshotPlan) and uses
createGitArchiveSnapshot for the git_archive mode. Reintroduces the git helpers
(snapshot_git.go, snapshot_resolve.go, snapshot_cachekey.go) removed in the tar PR.

Git resolution stays CLI-side (it is a train.yaml construct with no DABs config
surface); only the tarball upload reuses DABs plumbing.

Co-authored-by: Isaac
@github-actions

Copy link
Copy Markdown
Contributor

Waiting for approval

Based on git history, these people are best suited to review:

  • @riddhibhagwat-db -- recent work in experimental/air/cmd/

Eligible reviewers: @apeforest, @ben-hansen-db, @bfontain, @lu-wang-dl, @maggiewang-db, @panchalhp-db, @pardis-beikzadeh-db

Suggestions based on git history. See OWNERS for ownership rules.

@eng-dev-ecosystem-bot

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 9aeffa9

Run: 29859694409

Env 🟨​KNOWN 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
💚​ aws-cli-is linux 4 4 314 1043 5:49
💚​ aws-cli-is windows 4 4 316 1041 7:36
💚​ azure-cli-is linux 4 4 314 1042 5:17
💚​ azure-cli-is windows 4 4 316 1040 7:33
🟨​ gcp-cli-is linux 3 1 4 313 1044 8:48
🟨​ gcp-cli-is windows 3 1 4 315 1042 11:08
8 interesting tests: 4 SKIP, 3 KNOWN, 1 RECOVERED
Test Name aws-cli-is linux aws-cli-is windows azure-cli-is linux azure-cli-is windows gcp-cli-is linux gcp-cli-is windows
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/invariant/no_drift 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/recreate/embedding_dimension 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestFetchRepositoryInfoAPI_FromRepo 💚​R 💚​R 💚​R 💚​R 🟨​K 🟨​K
🟨​ TestFetchRepositoryInfoAPI_FromRepo/root 💚​R 💚​R 💚​R 💚​R 🟨​K 🟨​K
🟨​ TestFetchRepositoryInfoAPI_FromRepo/subdir 💚​R 💚​R 💚​R 💚​R 🟨​K 🟨​K
Top 6 slowest tests (at least 2 minutes):
duration env testname
6:33 aws-cli-is windows TestAccept
6:25 azure-cli-is windows TestAccept
6:08 gcp-cli-is windows TestAccept
2:58 aws-cli-is linux TestAccept
2:55 azure-cli-is linux TestAccept
2:51 gcp-cli-is linux TestAccept

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants