jason810496 commented on code in PR #52860: URL: https://github.com/apache/airflow/pull/52860#discussion_r2184992629
########## airflow-core/src/airflow/cli/commands/api_server_command.py: ########## @@ -40,6 +40,40 @@ # more info here: https://github.com/benoitc/gunicorn/issues/1877#issuecomment-1911136399 +def _run_api_server( + args, apps: str, access_logfile: str, num_workers: int, worker_timeout: int, proxy_headers: bool +): + """Run the API server.""" + log.info( + textwrap.dedent( + f"""\ + Running the uvicorn with: + Apps: {apps} + Workers: {num_workers} + Host: {args.host}:{args.port} + Timeout: {worker_timeout} + Logfiles: {access_logfile} + =================================================================""" + ) + ) + # get ssl cert and key filepaths here instead of passing them as arguments to reduce the number of arguments + ssl_cert, ssl_key = _get_ssl_cert_and_key_filepaths(args) + + setproctitle(f"airflow api_server -- host:{args.host} port:{args.port}") + uvicorn.run( + "airflow.api_fastapi.main:app", + host=args.host, + port=args.port, + workers=num_workers, + timeout_keep_alive=worker_timeout, + timeout_graceful_shutdown=worker_timeout, + ssl_keyfile=ssl_key, + ssl_certfile=ssl_cert, + access_log=access_logfile, # type: ignore[arg-type] Review Comment: The `access_log` argument type of `uvicorn.run` is annotated as `access_log: bool = True,`, but we are accepting `access_logfile` as `str` and pass to `uvicorn.run`. https://github.com/encode/uvicorn/blob/master/uvicorn/main.py#L492 https://github.com/apache/airflow/blob/7a44f9ada56175db83b69902fc6195bcbd419084/airflow-core/src/airflow/config_templates/config.yml#L1374-L1380 Do we need to cleanup the `access_logfile` config? Since no matter what user set, `access_logfile` will be cast to `True` and pass to `uvicorn.run`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
