feat: reserve queue capacity for recent models

This commit is contained in:
CoolBoy
2026-08-11 01:29:54 +08:00
parent 38ab25fc3c
commit f12d96b138
13 changed files with 927 additions and 46 deletions

View File

@@ -55,6 +55,9 @@ Optional tuning:
- `MODELHUB_QUEUE_CLEANUP_INTERVAL_CYCLES` default `120`; cleanup also runs once at startup
- `MODELHUB_QUEUE_CLEANUP_READ_CONCURRENCY` default `6`
- `MODELHUB_QUEUE_CLEANUP_REPORT_PATH` default `.modelhub_state/queue_cleanup_latest.json`
- `MODELHUB_OLD_MODEL_QUEUE_THRESHOLD` default `80` per account
- `MODELHUB_DYNAMIC_OLD_MODEL_CLEANUP_THRESHOLD` default `95` per account
- `MODELHUB_RECENT_MODEL_DAYS` default `7`
## Adaptive GPU Strategy
@@ -135,6 +138,25 @@ same model or infer failure from historical similarity. The cleanup repeats
every 120 poll cycles by default and writes its full evidence report to
`.modelhub_state/queue_cleanup_latest.json`.
Each account reserves only its first 80 active queue positions for models older
than seven days. Old-model reservations are made under the same account lock as
capacity reservations, so concurrent submissions cannot cross position 80.
Once every account has at least 80 active tasks, discovery is capped at the
seven-day window and only recent models can fill positions 81100. Unknown model
timestamps are treated as old for new submissions.
Queue cleanup applies a two-level version of the policy. On poller cycle 1 it
first stops deterministic OOM tasks, recalculates each account's surviving task
order by numeric task ID, and removes older-than-seven-days tasks after position
80. On later scheduled cleanup cycles, the age threshold relaxes to 95: old
tasks in positions 81-95 are retained and only old tasks at position 96 or later
are removed. New old-model submissions are still blocked at position 80, so the
upper queue remains available to recent models without repeatedly over-pruning
existing work. Recent overflow tasks are always kept. ModelScope metadata
failures fail closed and never trigger cancellation. Immediately before
mutation, task ownership, active status, and post-OOM queue position are checked
again.
The verified capacities, safe repository-size boundaries, evidence hierarchy,
and source links are recorded in
`docs/gpu-memory-capacity-2026-08-10.md`.
@@ -218,12 +240,16 @@ second active-state check and fail-closed handling for incomplete evidence.
Version `2026.08.11.2` removes LLM inference from every online path; credentials
alone cannot activate it, and unresolved cases remain available for offline,
human-reviewed rule development.
Version `2026.08.11.3` adds atomic per-account 80/7-day admission, prevents
history expansion once old-model positions are exhausted, performs a strict
position-80 startup cleanup, and relaxes scheduled age cleanup to position 95
after OOM cleanup and a second queue check.
## Deploy
Create a tag and submit the repository URL plus tag in "我的适配智能体".
```bash
git tag agent-v12
git push origin agent-v12
git tag agent-v17
git push origin agent-v17
```