MCPcopy Index your code
hub / github.com/volcengine/MineContext / start_web_server

Function start_web_server

opencontext/cli.py:110–137  ·  view source on GitHub ↗

Start the web server with the given opencontext instance. Args: context_lab_instance: The opencontext instance to attach to the app host: Host address to bind to port: Port number to bind to workers: Number of worker processes config_path: Configuration f

(
    context_lab_instance: OpenContext,
    host: str,
    port: int,
    workers: int = 1,
    config_path: str = None,
)

Source from the content-addressed store, hash-verified

108
109
110def start_web_server(
111 context_lab_instance: OpenContext,
112 host: str,
113 port: int,
114 workers: int = 1,
115 config_path: str = None,
116) -> None:
117 """Start the web server with the given opencontext instance.
118
119 Args:
120 context_lab_instance: The opencontext instance to attach to the app
121 host: Host address to bind to
122 port: Port number to bind to
123 workers: Number of worker processes
124 config_path: Configuration file path for multi-process mode
125 """
126 global _config_path
127 _config_path = config_path
128
129 if workers > 1:
130 logger.info(f"Starting with {workers} worker processes")
131 # For multi-process mode, use import string to avoid the warning
132 uvicorn.run("opencontext.cli:app", host=host, port=port,
133 log_level="info", workers=workers)
134 else:
135 # For single process mode, use the existing instance
136 app.state.context_lab_instance = context_lab_instance
137 uvicorn.run(app, host=host, port=port, log_level="info")
138
139
140def parse_args() -> argparse.Namespace:

Callers 1

handle_startFunction · 0.85

Calls 2

infoMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected