mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #333] [CLOSED] serve: add lazy startup and reliable Windows model cleanup #2582
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#2582
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/333
Author: @KadoBOT
Created: 10/1/2026
Status: ❌ Closed
Base:
main← Head:contrib/lazy-model-lifecycle📝 Commits (1)
a57ffa1serve: add lazy startup and reliable Windows model cleanup📊 Changes
3 files changed (+256 additions, -42 deletions)
View changed files
📝
docs/DETAILS.md(+17 -0)📝
serve/server.py(+92 -42)➕
serve/test_lifecycle.py(+147 -0)📄 Description
Strata can unload and reload an idle model, but the HTTP server still loads it during startup. On a shared GPU, that prevents keeping the API available without first occupying the GPU. This adds opt-in cold startup and consolidates native-process shutdown so Windows' stdin reader receives EOF before the server waits for exit.
Behavior
--lazyor"lazy_load": truestarts the text-only API with the model unloaded. The first generation uses the existing reload path, includingbefore_loadand the free-VRAM guard from #208. Eager startup remains the default; lazy startup with vision is explicitly rejected./v1/statusexposesloadedandauto_load,/propsreports the reload capability, and/api/healthaliases/health.POST /v1/loadand/v1/unloadaliases accepting an optional model name. They enforce the existing key and browser-Origin checks, reject a different model with 404, and return 409 while work is active or queued. Existing/loadand/unloadroutes remain available. Explicit loading refreshes the idle timer.QUIT, closes stdin, waits for exit, and releases the pump/pipe/log handles. If forced shutdown still times out, retain process ownership and report failure instead of claiming it was unloaded. Preserve Windows kill-on-close job containment.This extends #208 rather than reimplementing its idle-unload policy. It contains no model downloads, machine-specific configuration, or hardware tuning.
Validation
python -m unittest discover -s serve -p "test_*.py" -v— 86 tests, OK, 3 optional tests skipped.git diff --checkpassed.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.