mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
uvicorn allow setting num workers (#7681)
This commit is contained in:
parent
5c870c0c51
commit
9ac18caf24
1 changed files with 3 additions and 2 deletions
|
@ -68,7 +68,7 @@ def is_port_in_use(port):
|
||||||
@click.option(
|
@click.option(
|
||||||
"--num_workers",
|
"--num_workers",
|
||||||
default=1,
|
default=1,
|
||||||
help="Number of gunicorn workers to spin up",
|
help="Number of uvicorn / gunicorn workers to spin up. By default, 1 uvicorn is used.",
|
||||||
envvar="NUM_WORKERS",
|
envvar="NUM_WORKERS",
|
||||||
)
|
)
|
||||||
@click.option("--api_base", default=None, help="API base URL.")
|
@click.option("--api_base", default=None, help="API base URL.")
|
||||||
|
@ -653,7 +653,7 @@ def run_server( # noqa: PLR0915
|
||||||
from litellm.proxy.proxy_server import app # noqa
|
from litellm.proxy.proxy_server import app # noqa
|
||||||
|
|
||||||
uvicorn_args = {
|
uvicorn_args = {
|
||||||
"app": app,
|
"app": "litellm.proxy.proxy_server:app",
|
||||||
"host": host,
|
"host": host,
|
||||||
"port": port,
|
"port": port,
|
||||||
}
|
}
|
||||||
|
@ -674,6 +674,7 @@ def run_server( # noqa: PLR0915
|
||||||
uvicorn.run(
|
uvicorn.run(
|
||||||
**uvicorn_args,
|
**uvicorn_args,
|
||||||
loop="uvloop",
|
loop="uvloop",
|
||||||
|
workers=num_workers,
|
||||||
)
|
)
|
||||||
elif run_gunicorn is True:
|
elif run_gunicorn is True:
|
||||||
# Gunicorn Application Class
|
# Gunicorn Application Class
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue