Skip to content

feat(backends): add Uninstall method to Backend interface and uninstall-backend endpoint#770

Merged
doringeman merged 1 commit intodocker:mainfrom
doringeman:uninstall-runner-for-deferred-backends
Mar 20, 2026
Merged

feat(backends): add Uninstall method to Backend interface and uninstall-backend endpoint#770
doringeman merged 1 commit intodocker:mainfrom
doringeman:uninstall-runner-for-deferred-backends

Conversation

@doringeman
Copy link
Contributor

Deferred backends (vllm-metal, diffusers) install to local directories but had no cleanup path; this lets the CLI trigger backend removal via the running model-runner.

make -C cmd/cli/ install
MODEL_RUNNER_PORT=8080 make run
MODEL_RUNNER_HOST=http://localhost:8080 docker model run hf.co/mlx-community/Qwen3.5-4B-MLX-4bit hi
$ MODEL_RUNNER_HOST=http://localhost:8080 docker model ps
MODEL NAME                               BACKEND  MODE        UNTIL
hf.co/mlx-community/Qwen3.5-4B-MLX-4bit  vllm     completion  4 minutes from now

On uninstalling, the backend will first be unloaded.

MODEL_RUNNER_HOST=http://localhost:8080 docker model uninstall-runner --backend vllm
Uninstalled vllm backend

Server logs:

time=2026-03-20T16:04:29.532+02:00 level=INFO msg="Evicting backend runner for uninstall" backend=vllm model=sha256:2a1d97082d5ea6d15b4c005b9e29d88516137079ac0a959461fabe6686871ac3 modelRef=hf.co/mlx-community/Qwen3.5-4B-MLX-4bit mode=completion
time=2026-03-20T16:04:29.532+02:00 level=INFO msg="(APIServer pid=99071) INFO 03-20 16:04:29 [launcher.py:122] Shutting down FastAPI HTTP server."
time=2026-03-20T16:04:29.644+02:00 level=INFO msg="(APIServer pid=99071) INFO:     Shutting down"
time=2026-03-20T16:04:29.745+02:00 level=INFO msg="(APIServer pid=99071) INFO:     Waiting for application shutdown."
time=2026-03-20T16:04:29.745+02:00 level=INFO msg="(APIServer pid=99071) INFO:     Application shutdown complete."
time=2026-03-20T16:04:29.836+02:00 level=INFO msg="getting model by reference" component=model-manager reference=sha256:2a1d97082d5ea6d15b4c005b9e29d88516137079ac0a959461fabe6686871ac3
time=2026-03-20T16:04:29.836+02:00 level=INFO msg="Listing available models" component=model-manager
time=2026-03-20T16:04:29.844+02:00 level=INFO msg="successfully listed models" component=model-manager count=24
time=2026-03-20T16:04:29.844+02:00 level=INFO msg="Removed records for model" component=openai-recorder model=sha256:2a1d97082d5ea6d15b4c005b9e29d88516137079ac0a959461fabe6686871ac3
time=2026-03-20T16:04:32.785+02:00 level=INFO msg="Backend uninstalled" backend=vllm

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • Scheduler.UninstallBackend proceeds with installer.uninstallBackend even if UnloadBackend leaves active runners with non-zero references, which can result in running processes using files that have been removed; consider returning an error or blocking until all references are drained before uninstalling the backend.
  • The new loader.UnloadBackend logic partly duplicates the eviction behavior in Unload; you might want to reuse or refactor the existing unload path so that runner selection and logging remain consistent and future changes to eviction behavior don’t need to be updated in multiple places.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Scheduler.UninstallBackend proceeds with installer.uninstallBackend even if UnloadBackend leaves active runners with non-zero references, which can result in running processes using files that have been removed; consider returning an error or blocking until all references are drained before uninstalling the backend.
- The new loader.UnloadBackend logic partly duplicates the eviction behavior in Unload; you might want to reuse or refactor the existing unload path so that runner selection and logging remain consistent and future changes to eviction behavior don’t need to be updated in multiple places.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

…ll-backend endpoint

Deferred backends (vllm-metal, diffusers) install to local directories but had no cleanup path; this lets the CLI trigger backend removal via the running model-runner.

Signed-off-by: Dorin Geman <dorin.geman@docker.com>
@doringeman doringeman force-pushed the uninstall-runner-for-deferred-backends branch from e9c195e to 72809c5 Compare March 20, 2026 14:08
@gemini-code-assist
Copy link
Contributor

Warning

Gemini is experiencing higher than usual traffic and was unable to create the review. Please try again in a few hours by commenting /gemini review.

@doringeman doringeman merged commit 8babe24 into docker:main Mar 20, 2026
9 checks passed
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.

3 participants