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

Function launch_api_server

fastdeploy/entrypoints/api_server.py:95–118  ·  view source on GitHub ↗

启动http服务

(args)

Source from the content-addressed store, hash-verified

93
94
95def launch_api_server(args) -> None:
96 """
97 启动http服务
98 """
99 if not is_port_available(args.host, args.port):
100 raise Exception(f"The parameter `port`:{args.port} is already in use.")
101
102 api_server_logger.info(f"launch Fastdeploy api server... port: {args.port}")
103 api_server_logger.info(f"args: {args.__dict__}")
104
105 if not init_app(args):
106 api_server_logger.error("API Server launch failed.")
107 return
108
109 try:
110 uvicorn.run(
111 app=app,
112 host=args.host,
113 port=args.port,
114 workers=args.workers,
115 log_level="info",
116 ) # set log level to error to avoid log
117 except Exception as e:
118 api_server_logger.error(f"launch sync http server error, {e}, {str(traceback.format_exc())}")
119
120
121def main():

Callers 1

mainFunction · 0.70

Calls 5

is_port_availableFunction · 0.90
init_appFunction · 0.85
infoMethod · 0.45
errorMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected