AI: never cut a request off mid-reply; bound the logs and the stop path
- service.py: the idle stop's settings write now happens under the same lock claim() holds, so a request arriving between the idle check and the write can no longer have its selection overwritten and its server stopped under it. - service.py: _reconcile no longer stops or replaces a server with a request in flight, however the switch happens (selecting another backend or None, changing Strata's model): the old server finishes its request, and the new one does not start until the GPU's memory is free again. - service.py: an "external" server is only used once a poll has proved the program behind its port answers as that server; a port held by something else now fails the request saying who holds it, instead of forwarding prompts to it. - strata_host.py: the stop watchdog is real -- if server.main never returns within 40 s of the stop request it ends the engine processes and exits, instead of relying on interrupt_main() alone (The Kurgan's 45 s kill stays as the last resort); the never-read stopping event is gone. It rotates its logs at startup: the task log keeps one .prev, the newest seven stdout or stderr files per start are kept. - backends.py: StrataBackend.before_start rotates strata-host.log the way LlamaBackend does for llama-server.log. - tests: five new tests (the two draining guards, external verification, both rotations). README updated to match. VRAM-aware start (the review's "port closed != GPU free, check VRAM before start") stays a capability idea: no setting knows a model's size to check free VRAM against.
This commit is contained in:
1 parent
9036c6e734
commit
8969a57045
5 files changed
+171
-23
No files matched your search
@@ -202,6 +202,16 @@ class StrataBackend(Backend):
|
||||
finally:
|
||||
_k32.CloseHandle(handle)
|
||||
|
||||
def before_start(self) -> None:
|
||||
# The launcher appends; keep one previous run's log, as LlamaBackend does for its own.
|
||||
os.makedirs(LOG_DIR, exist_ok=True)
|
||||
try:
|
||||
path = os.path.join(LOG_DIR, "strata-host.log")
|
||||
if os.path.exists(path):
|
||||
os.replace(path, os.path.join(LOG_DIR, "strata-host.prev.log"))
|
||||
except OSError as e:
|
||||
log.warning("Could not rotate strata-host.log: %s", e)
|
||||
|
||||
def _url(self, path: str) -> str:
|
||||
return f"http://127.0.0.1:{self.port}{path}"
|
||||
|
||||
|
||||
Reference in new issue
Block a user