- pool.py: WorkerState 增加 primary 标记;acquire_worker 分级派发—— 主组有在线只在主组内挑空闲(全忙排队,不退备组),主组全部下线才用备机 - config.py: 新增可选 primary_workers 配置(须为 workers 子集,自动过滤+告警); 不配置/空列表 = 全部视为主 worker,兼容旧行为 - config.json(不入 git): 3 台 GPU worker 设为主,max_global_concurrency 1→3 - app.py: /health 增加 workers_primary_total / workers_primary_healthy - tests: 新增 4 条主备派发单测(主优先/主全挂用备/主全忙不走备/无配置兼容) - docs(实现说明): 补充 primary_workers 配置说明,改配置需重启网关生效
29 lines
699 B
JSON
29 lines
699 B
JSON
{
|
|
"workers": [
|
|
"http://127.0.0.1:28187",
|
|
"http://127.0.0.1:28188"
|
|
],
|
|
"primary_workers": [],
|
|
"shared_password": "REPLACE_ME_ROTATE_PERIODICALLY",
|
|
"public_base_url": "https://hair.xiangsilian.com",
|
|
"static_dir": "static/annotations",
|
|
"health_check": {
|
|
"path": "/health",
|
|
"interval_seconds": 8,
|
|
"timeout_seconds": 3,
|
|
"unhealthy_threshold": 2,
|
|
"healthy_threshold": 1,
|
|
"cooldown_seconds": 60
|
|
},
|
|
"ark_api_key": "",
|
|
"dispatch": {
|
|
"per_worker_concurrency": 1,
|
|
"max_global_concurrency": 1,
|
|
"max_queue_wait_seconds": 590,
|
|
"queue_wait_seconds": 30,
|
|
"request_timeout_seconds": 600,
|
|
"retry_on_failure": true,
|
|
"max_retries": 1
|
|
}
|
|
}
|