Skip to content

refactor(ansible): drive the model downloads with one loop task - #7268

Merged
xmfcx merged 1 commit into
autowarefoundation:mainfrom
xmfcx:refactor/artifacts-download-loop
Aug 14, 2026
Merged

xmfcx merged 1 commit into
autowarefoundation:mainfrom
xmfcx:refactor/artifacts-download-loop

Conversation

@xmfcx

@xmfcx xmfcx commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Description

All 20 hf download tasks in the artifacts role were identical except for the repository, the tag and the local directory. One task now loops over a table of {repo, revision, dest}. dest is relative to data_dir and defaults to the repository name.

Five rows set dest. The four diffusion_planner tags each hold the same filenames at the repository root, so they need separate directories or they overwrite each other. tensorrt_vad goes to vad/v0.1, because the node reads $(var data_path)/vad/v0.1.

The 20 rendered commands, the environment and the destinations are byte-identical to the tasks they replace. The load-bearing comments stay on the table rows. loop_control: label keeps the play output at one line per bundle, labeled <repo> <revision>.

One behavior changes. A failed download no longer stops the bundles after it. Ansible runs every loop item, then reports the task as failed, so the play still stops at the task. A user with one bad tag keeps the other bundles, and a failing CI job spends the full remaining download time before it ends.

How to verify

  1. Check out the branch and install the collection:

    gh pr checkout 7268
    ansible-galaxy collection install -f -r ansible-galaxy-requirements.yaml
  2. Run the role:

    ansible-playbook autoware.dev_env.install_dev_env --tags artifacts -e "data_dir=$HOME/autoware_data/ml_models" --ask-become-pass

    Note: a cold run downloads 2.68 GB. If the Hub rate-limits the anonymous downloads, set HF_TOKEN.

  3. Make sure that the task prints one line per bundle, 20 in total, labeled <repo> <revision>.

  4. Make sure that the recap shows failed=0.

  5. Make sure that the versioned destinations are on disk:

    ls ~/autoware_data/ml_models/diffusion_planner   # v3.0  v3.1  v4.0  v5.0
    ls ~/autoware_data/ml_models/vad                 # v0.1
  6. To compare the table against the 20 old tasks, read the diff: git diff main -- ansible/roles/artifacts/tasks/main.yaml.

AI usage

AI usage: written with Claude Code from the follow-up list in #7223

Self-review: A clean-context Claude Code session reviewed the branch with two agents, an impact trace and an alternatives pass, in one round. The findings, three dropped comments and an unstated behavior change, are fixed on the branch. I read and approved the final diff.

Verification: The 20 rendered commands are byte-identical to the tasks they replace, shown by rendering both file versions through Ansible and diffing the output. The role ran end to end on a warm install with failed=0. Lint is clean.

Local playbook run

Ubuntu 24.04, warm ~/autoware_data/ml_models, collection reinstalled from the working tree.

  • The task printed one ok line per bundle, 20 in total, labeled <repo> <revision>
  • Recap: ok=6 changed=0 unreachable=0 failed=0 skipped=2
  • real 0m28.070s
  • The lidar_centerpoint v4.0 bundle was not on disk before the run. The run downloaded it, and the base, tiny, sigma and short_range variant folders appeared
  • Not run locally: the full install_dev_env playbook. Its version_lock cleanup task needs sudo, which this session cannot provide. The role was run through a minimal playbook that includes autoware.dev_env.artifacts with its dependencies. The run:health-check CI job runs the full playbook on a cold runner

Rendered command comparison

Both file versions were copied into playbooks with the command module swapped for ansible.builtin.debug, run under ansible-core 2.17.14 with data_dir=/DATA, and the 20 rendered strings diffed.

  • 20 commands before, 20 commands after, diff empty. The (repo, revision, destination) triples match in the same order
  • The five non-default destinations render as /DATA/diffusion_planner/v3.0, /v3.1, /v4.0, /v5.0 and /DATA/vad/v0.1
  • Not run here: the real hf download transfers. The test proves the argument strings, not the downloads

Loop failure semantics

A three-item loop was run with the middle item made to fail, in both shapes.

  • Loop shape: the third item still ran after the second failed. Recap ok=0 changed=0 unreachable=0 failed=1
  • Separate-task shape: the play stopped at the failed task, and the third item never ran
  • Not run here: a real failed download against the Hub. The reproduction used a command with a non-zero exit

Lint and format

  • ansible-lint ansible/roles/artifacts/: Passed: 0 failure(s), 0 warning(s), profile production, at 26.6.0, the revision pinned in .pre-commit-config-ansible.yaml
  • pre-commit run on the changed files: prettier and yamllint Passed
  • Both ran on the final branch state, with the comments back on the table rows
  • Not run again after the comment restore: the playbook. That change touches comments only

@xmfcx xmfcx added type:installation Issues or improvements related to the installation process of the software. run:health-check Run health-check labels Aug 14, 2026
@xmfcx xmfcx self-assigned this Aug 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for contributing to the Autoware project!

🚧 If your pull request is in progress, switch it to draft mode.

Please ensure:

@xmfcx
xmfcx force-pushed the refactor/artifacts-download-loop branch from 6699f8f to 52d47ac Compare August 14, 2026 07:32
All 20 hf download tasks in the artifacts role were identical except for
the repository, the tag and the local directory. One task now loops over
a table of {repo, revision, dest}, with dest defaulting to the
repository name. The load-bearing comments stay on the table rows.

The 20 rendered commands, the environment and the destinations are
unchanged. One behavior changes: a failed download no longer stops the
bundles after it. Ansible runs every loop item, then reports the task as
failed, so the play still stops at the task.

Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org>
@xmfcx
xmfcx force-pushed the refactor/artifacts-download-loop branch from 52d47ac to 0172f18 Compare August 14, 2026 07:57
@xmfcx
xmfcx marked this pull request as ready for review August 14, 2026 08:01
@mergify

mergify Bot commented Aug 14, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@xmfcx
xmfcx merged commit 7e79d65 into autowarefoundation:main Aug 14, 2026
24 of 25 checks passed
@xmfcx
xmfcx deleted the refactor/artifacts-download-loop branch August 14, 2026 09:27
TomcoGame pushed a commit to TomcoGame/Autoware-Assurance-Stack that referenced this pull request Oct 25, 2026
…warefoundation#7268)

All 20 hf download tasks in the artifacts role were identical except for
the repository, the tag and the local directory. One task now loops over
a table of {repo, revision, dest}, with dest defaulting to the
repository name. The load-bearing comments stay on the table rows.

The 20 rendered commands, the environment and the destinations are
unchanged. One behavior changes: a failed download no longer stops the
bundles after it. Ansible runs every loop item, then reports the task as
failed, so the play still stops at the task.

Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run:health-check Run health-check type:installation Issues or improvements related to the installation process of the software.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants