Print default values
This commit is contained in:
parent
1f4bfd2a24
commit
d9a18ac982
2 changed files with 15 additions and 11 deletions
|
|
@ -43,9 +43,9 @@ def main() -> None:
|
|||
args = parse_arguments()
|
||||
should_auto_reload = not _is_in_production_mode(logger=None)
|
||||
|
||||
if args.workers > 1 and should_auto_reload:
|
||||
if args.worker_count > 1 and should_auto_reload:
|
||||
raise ArgumentValidationError(
|
||||
"Cannot use auto-reload with multiple workers: set the `--workers=1` CLI argument,"
|
||||
"Cannot use auto-reload with multiple worker_count: set the `--worker_count=1` CLI argument,"
|
||||
+ "or set the ENVIRONMENT environment variable to `production`."
|
||||
)
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ def main() -> None:
|
|||
host=args.host,
|
||||
port=args.port,
|
||||
timeout_keep_alive=args.timeout_keep_alive,
|
||||
workers=args.workers,
|
||||
workers=args.worker_count,
|
||||
server_header=False,
|
||||
reload=False,
|
||||
log_config=GREAT_AI_LOGGING_CONFIG,
|
||||
|
|
|
|||
|
|
@ -12,35 +12,39 @@ def parse_arguments() -> Namespace:
|
|||
help="the name of the file containing your to-be-served function such as `main.py`\n",
|
||||
)
|
||||
|
||||
default_host = "0.0.0.0"
|
||||
parser.add_argument(
|
||||
"--host",
|
||||
type=str,
|
||||
help="it is passed to uvicorn which starts a server listening on this address",
|
||||
default="0.0.0.0",
|
||||
help=f"it is passed to uvicorn which starts a server listening on this address (default: {default_host})",
|
||||
default=default_host,
|
||||
required=False,
|
||||
)
|
||||
|
||||
default_port = 6060
|
||||
parser.add_argument(
|
||||
"--port",
|
||||
type=int,
|
||||
help="it is passed to uvicorn which starts a server listening on this port",
|
||||
default=6060,
|
||||
help=f"it is passed to uvicorn which starts a server listening on this port (default: {default_port})",
|
||||
default=default_port,
|
||||
required=False,
|
||||
)
|
||||
|
||||
default_timeout_keep_alive = 600
|
||||
parser.add_argument(
|
||||
"--timeout_keep_alive",
|
||||
type=int,
|
||||
help="it is passed to uvicorn which uses it for timing out requests taking longer than this many seconds",
|
||||
help=f"it is passed to uvicorn which uses it for timing out requests taking longer than this many seconds (default: {default_timeout_keep_alive})",
|
||||
default=600,
|
||||
required=False,
|
||||
)
|
||||
|
||||
default_worker_count = 1
|
||||
parser.add_argument(
|
||||
"--workers",
|
||||
"--worker_count",
|
||||
type=int,
|
||||
help="it is passed to uvicorn which starts this many server processes",
|
||||
default=1,
|
||||
help=f"it is passed to uvicorn which starts this many server processes (default: {default_worker_count})",
|
||||
default=default_worker_count,
|
||||
required=False,
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue