LCORE-1869: Add graceful teardown and automatic cleanup for llama-stack container#1802
LCORE-1869: Add graceful teardown and automatic cleanup for llama-stack container#1802anik120 wants to merge 1 commit into
Conversation
WalkthroughMakefile updates add a trap in ChangesContainer Lifecycle Management
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…ck container **Key Changes:** - Auto-stop container when exiting `make run` (Ctrl+C) via trap handler - Graceful shutdown with 10s timeout before force-kill - Preserve logs to `/tmp/llama-stack-*.log` on shutdown/removal **Developer Experience:** - No manual cleanup needed - just Ctrl+C - Logs preserved after container removal - Clearer feedback during shutdown Signed-off-by: Anik Bhattacharjee <anbhatta@redhat.com>
b180b20 to
0b2ff52
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
Makefile (1)
15-15:⚠️ Potential issue | 🟠 Major | ⚡ Quick winMake E2E container name match
LLAMA_STACK_CONTAINER_NAME
MakefilesetsLLAMA_STACK_CONTAINER_NAME ?= lightspeed-llama-stack, but E2E scripts hardcode the Docker container name"llama-stack"when callingdocker inspect/stop/start(e.g.,tests/e2e/features/steps/health.py,tests/e2e/features/environment.py) and don’t referenceLLAMA_STACK_CONTAINER_NAME.- Fix by updating E2E to use
LLAMA_STACK_CONTAINER_NAME(via a shared helper/config/env var) or by ensuringmake runstarts the container with the"llama-stack"name.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Makefile` at line 15, E2E scripts hardcode the Docker name "llama-stack" while the Makefile defines LLAMA_STACK_CONTAINER_NAME; update the E2E code (e.g., in tests/e2e/features/steps/health.py and tests/e2e/features/environment.py) to read the container name from the environment variable LLAMA_STACK_CONTAINER_NAME (use os.environ.get('LLAMA_STACK_CONTAINER_NAME', 'llama-stack')) and use that value for all docker inspect/stop/start invocations so the tests follow the Makefile-controlled container name.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@Makefile`:
- Line 15: E2E scripts hardcode the Docker name "llama-stack" while the Makefile
defines LLAMA_STACK_CONTAINER_NAME; update the E2E code (e.g., in
tests/e2e/features/steps/health.py and tests/e2e/features/environment.py) to
read the container name from the environment variable LLAMA_STACK_CONTAINER_NAME
(use os.environ.get('LLAMA_STACK_CONTAINER_NAME', 'llama-stack')) and use that
value for all docker inspect/stop/start invocations so the tests follow the
Makefile-controlled container name.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 984d99d4-8f79-40fb-89cc-a77c41f14088
📒 Files selected for processing (1)
Makefile
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
- GitHub Check: unit_tests (3.13)
- GitHub Check: unit_tests (3.12)
- GitHub Check: spectral
- GitHub Check: integration_tests (3.12)
- GitHub Check: build-pr
- GitHub Check: Pylinter
- GitHub Check: E2E Tests for Lightspeed Evaluation job
- GitHub Check: E2E: library mode / ci / group 1
- GitHub Check: E2E: library mode / ci / group 3
- GitHub Check: E2E: server mode / ci / group 1
- GitHub Check: E2E: library mode / ci / group 2
- GitHub Check: E2E: server mode / ci / group 2
- GitHub Check: Konflux kflux-prd-rh02 / lightspeed-stack-on-pull-request
🧰 Additional context used
🪛 checkmake (0.3.2)
Makefile
[warning] 21-21: Required target "all" is missing from the Makefile.
(minphony)
[warning] 21-21: Required target "clean" is missing from the Makefile.
(minphony)
[warning] 21-21: Required target "test" is missing from the Makefile.
(minphony)
[warning] 35-35: Target body for "stop-llama-stack-container" exceeds allowed length of 5 lines (11).
(maxbodylength)
[warning] 48-48: Target body for "remove-llama-stack-container" exceeds allowed length of 5 lines (7).
(maxbodylength)
🔇 Additional comments (4)
Makefile (4)
20-20: LGTM!
24-25: LGTM!
35-46: LGTM!
48-55: LGTM!
Description
Key Changes:
make run(Ctrl+C) via trap handler/tmp/llama-stack-*.logon shutdown/removalDeveloper Experience:
Signed-off-by: Anik Bhattacharjee anbhatta@redhat.com
Type of change
Tools used to create PR
Identify any AI code assistants used in this PR (for transparency and review context)
Related Tickets & Documents
Checklist before requesting a review
Testing
Summary by CodeRabbit