Pull requests / #2598

#2598 Docker: IDLE_UNLOAD_S unloads the model after that many idle seconds, for a config setup rewrites too (#1952)

closed · @qiuzan2001 · 0 コメント · GitHub で見る

Setup & installServer & APIDocumentationLinux

本文

Fixes #1952 (opt-in: nothing changes unless the variable is set).

**What it changes.** The server's idle unload (`"idle_unload_s"` in the run config, `--idle-unload`) was reachable
in the container only by editing the generated config on the volume, and `REINSTALL=1` rewrote that config without
it.
- `docker-entrypoint.sh` reads `IDLE_UNLOAD_S` and exports it as `STRATA_IDLE_UNLOAD_S` before it starts setup.
  setup starts the server with the inherited environment.
- `serve/server.py`: a new `idle_unload_seconds(arg, cfg, env)` takes `--idle-unload`, else the config's
  `"idle_unload_s"`, else `STRATA_IDLE_UNLOAD_S`. A value that is not a number is said once, and the model stays
  loaded.
- docs/INSTALL.md (Docker), the DETAILS.md settings row and the Dockerfile's list of env vars say so.

**What it leaves alone.** Without the variable, every config gives the same value as before: a missing key, `null`
and `""` give 0; `0`, a number and a numeric string are read as before. A config's own `"idle_unload_s"` (a `0`
included) still wins over the variable, and `--idle-unload` wins over both. The idle unload itself is unchanged.

**How it was checked.**
- `tools/test_docker_entrypoint.py` `test_idle_unload_s_reaches_the_server_1952`: the server's environment gets
  `STRATA_IDLE_UNLOAD_S=120` on a plain start and with `REINSTALL=1`, and nothing when the variable is empty. (The
  stub server prints the variable.)
- `serve/test_lifecycle.py` `IdleUnloadSetting`: the order of the three sources, a config's `0`, no variable, a
  variable that is not a number, and a negative one.
- Both fail on `main`. `python3 tools/test_docker_entrypoint.py`: 10 OK. With the venv's Python, `serve.test_lifecycle`,
  `serve.test_runconfig` and `serve.test_server`: OK.
- Python 3.14, Ubuntu (Linux 7.0). Not run in the Docker image.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

関連リンク

インストール・モデル・リリースへの站内リンク。