[APIServer] support define gunicorn timeout (#4496)
Some checks failed
CE Compile Job / ce_job_pre_check (push) Has been cancelled
CE Compile Job / print_ce_job_pre_check_outputs (push) Has been cancelled
CE Compile Job / FD-Clone-Linux (push) Has been cancelled
CE Compile Job / Show Code Archive Output (push) Has been cancelled
CE Compile Job / BUILD_SM8090 (push) Has been cancelled
CE Compile Job / BUILD_SM8689 (push) Has been cancelled
CE Compile Job / CE_UPLOAD (push) Has been cancelled
Deploy GitHub Pages / deploy (push) Has been cancelled

* [BUGFIX] clear request #4286

* [BugFix] support define gunicorn timeout

* Update utils.py

* Update utils.py

---------

Co-authored-by: ltd0924 <luotingdan@baidu.com>
This commit is contained in:
ltd0924
2025-10-20 23:36:07 +08:00
committed by GitHub
parent cef3164c3b
commit a498736af5
2 changed files with 10 additions and 3 deletions

View File

@@ -503,8 +503,8 @@ def launch_api_server() -> None:
"workers": args.workers,
"worker_class": "uvicorn.workers.UvicornWorker",
"loglevel": "info",
"log_config": UVICORN_CONFIG,
"timeout_graceful_shutdown": args.timeout_graceful_shutdown,
"graceful_timeout": args.timeout_graceful_shutdown,
"timeout": args.timeout,
}
try:

View File

@@ -227,7 +227,14 @@ def make_arg_parser(parser: FlexibleArgumentParser) -> FlexibleArgumentParser:
"--timeout-graceful-shutdown",
default=0,
type=int,
help="timeout for graceful shutdown in seconds (used by uvicorn)",
help="timeout for graceful shutdown in seconds (used by gunicorn).Setting it to 0 has the effect of infinite timeouts by disabling timeouts for all workers entirely.",
)
parser.add_argument(
"--timeout",
default=0,
type=int,
help="Workers silent for more than this many seconds are killed and restarted.Value is a positive number or 0. Setting it to 0 has the effect of infinite timeouts by disabling timeouts for all workers entirely.",
)
parser = EngineArgs.add_cli_args(parser)