MCPcopy Create free account
hub / github.com/PaddlePaddle/FastDeploy / launch_api_server

Function launch_api_server

fastdeploy/entrypoints/openai/api_server.py:724–750  ·  view source on GitHub ↗

启动http服务

()

Source from the content-addressed store, hash-verified

722
723
724def launch_api_server() -> None:
725 """
726 启动http服务
727 """
728 if not is_port_available(args.host, args.port):
729 raise Exception(f"The parameter `port`:{args.port} is already in use.")
730
731 api_server_logger.info(f"launch Fastdeploy api server... port: {args.port}")
732 api_server_logger.info(f"args: {args.__dict__}")
733 # fd_start_span("FD_START")
734
735 # Set control_socket_disable=True to prevent gunicorn.ctl file conflicts when multiple
736 # instances (e.g., Prefill and Decode services) run in the same directory (gunicorn 25.1.0+)
737 options = {
738 "bind": f"{args.host}:{args.port}",
739 "workers": args.workers,
740 "worker_class": "uvicorn.workers.UvicornWorker",
741 "loglevel": "info",
742 "graceful_timeout": args.timeout_graceful_shutdown,
743 "timeout": args.timeout,
744 "control_socket_disable": True,
745 }
746
747 try:
748 StandaloneApplication(app, options).run()
749 except Exception as e:
750 api_server_logger.error(f"launch sync http server error, {e}, {str(traceback.format_exc())}")
751
752
753metrics_app = FastAPI()

Callers 1

mainFunction · 0.70

Calls 5

is_port_availableFunction · 0.90
infoMethod · 0.45
runMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected