-
Notifications
You must be signed in to change notification settings - Fork 293
CI: retry ollama pull #2290
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
base: main
Are you sure you want to change the base?
CI: retry ollama pull #2290
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdds retry logic for flaky File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Summary of ChangesHello @olliewalsh, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the reliability of CI pipelines by addressing the known flakiness of the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Hey - I've found 1 issue, and left some high level feedback:
- In
pull_model, consider replacing thewhile True+ manual decrement with a bounded loop (e.g.for _ in range(retries)) and adding a small sleep/backoff between attempts so failures don’t spin immediately and the max number of attempts is clearer. - The retry pattern for
ollama pullin050-pull.batsis duplicated three times; consider extracting this into a small helper or function to keep the test logic DRY and easier to tweak if the retry behavior changes.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `pull_model`, consider replacing the `while True` + manual decrement with a bounded loop (e.g. `for _ in range(retries)`) and adding a small sleep/backoff between attempts so failures don’t spin immediately and the max number of attempts is clearer.
- The retry pattern for `ollama pull` in `050-pull.bats` is duplicated three times; consider extracting this into a small helper or function to keep the test logic DRY and easier to tweak if the retry behavior changes.
## Individual Comments
### Comment 1
<location> `test/system/050-pull.bats:38-47` </location>
<code_context>
ollama serve &
sleep 3
- ollama pull tinyllama
+ (for i in $(seq 0 3); do ollama pull tinyllama && exit 0; done; ollama pull tinyllama)
run_ramalama pull ollama://tinyllama
run_ramalama rm ollama://tinyllama
ollama rm tinyllama
- ollama pull smollm:135m
+ (for i in $(seq 0 3); do ollama pull smollm:135m && exit 0; done; ollama pull smollm:135m)
run_ramalama pull https://ollama.com/library/smollm:135m
run_ramalama list
is "$output" ".*ollama://library/smollm:135m" "image was actually pulled locally from ollama cache"
- ollama pull smollm:360m
+ (for i in $(seq 0 3); do ollama pull smollm:360m && exit 0; done; ollama pull smollm:360m)
RAMALAMA_TRANSPORT=ollama run_ramalama pull smollm:360m
run_ramalama pull ollama://smollm:360m
</code_context>
<issue_to_address>
**suggestion:** Factor out the repeated retry pattern into a helper to keep the system test DRY and more maintainable.
The retry snippet `(for i in $(seq 0 3); do ollama pull <model> && exit 0; done; ollama pull <model>)` is repeated for three models. Define a small Bats helper (e.g., `retry_ollama_pull <model>`) in `setup_suite` or a shared helper file and call that instead to avoid duplication and keep retry behavior consistent.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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.
Code Review
This pull request adds much-needed retry logic to address the flakiness of ollama pull in the test suite, which is a great step towards improving CI reliability. My review includes suggestions to make this new retry logic even more robust and maintainable. In the Python test helper, I've recommended using a more idiomatic for loop and adding a delay between retries. For the BATS tests, I've highlighted code duplication and the same missing delay, suggesting a refactoring into a helper function and providing an improved one-liner with a sleep command.
|
LGTM |
07a65d2 to
81f7bc3
Compare
|
PR #2289 marks the failing tests with |
ollama seems to be stable again now. It's github project has a number of open issues related to pulling images though so I think this retry logic is still worth merging |
Signed-off-by: Oliver Walsh <owalsh@redhat.com>
81f7bc3 to
9a29657
Compare
ollama pull is unreliable, consistently failing on the first attempt. Add some retry logic.
Summary by Sourcery
Add retry logic around flaky
ollama pulloperations in tests to improve reliability.Tests:
ollama pullcommands in system tests with simple shell retry loops to reduce flakiness.