vllm.entrypoints.openai.api_server ¶
_startup_prefetch_weights ¶
_startup_prefetch_weights(vllm_config: VllmConfig) -> None
Kick off reading model weight shards into OS page cache from the parent APIServer. EngineCore will read the same files a few seconds later from the child; by then the kernel already has them ready.
All work (directory resolution, HF/ModelScope cache lookup, globbing, and the reads themselves) runs inside the background thread so we do not block the asyncio event loop.
Best-effort: any failure (unknown model location, permission, etc.) is swallowed — vLLM's existing in-child prefetch then runs normally.
Source code in vllm/entrypoints/openai/api_server.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |
build_and_serve async ¶
build_and_serve(
engine_client: EngineClient,
listen_address: str,
sock: socket,
args: Namespace,
**uvicorn_kwargs,
) -> Task
Build FastAPI app, initialize state, and start serving.
Returns the shutdown task for the caller to await.
Source code in vllm/entrypoints/openai/api_server.py
build_and_serve_renderer async ¶
build_and_serve_renderer(
vllm_config: VllmConfig,
listen_address: str,
sock: socket,
args: Namespace,
**uvicorn_kwargs,
) -> Task
Build FastAPI app for a CPU-only render server, initialize state, and start serving.
Returns the shutdown task for the caller to await.
Source code in vllm/entrypoints/openai/api_server.py
build_async_engine_client_from_engine_args async ¶
build_async_engine_client_from_engine_args(
engine_args: AsyncEngineArgs,
*,
usage_context: UsageContext = OPENAI_API_SERVER,
client_config: dict[str, Any] | None = None,
) -> AsyncIterator[EngineClient]
Create EngineClient, either: - in-process using the AsyncLLMEngine Directly - multiprocess using AsyncLLMEngine RPC
Returns the Client or None if the creation failed.
Source code in vllm/entrypoints/openai/api_server.py
init_render_app_state async ¶
init_render_app_state(
vllm_config: VllmConfig, state: State, args: Namespace
) -> None
Initialise FastAPI app state for a CPU-only render server.
Unlike :func:init_app_state this function does not require an :class:~vllm.engine.protocol.EngineClient; it bootstraps the preprocessing pipeline (renderer, input_processor) directly from the :class:~vllm.config.VllmConfig.
Source code in vllm/entrypoints/openai/api_server.py
run_server async ¶
Run a single-worker API server.
Source code in vllm/entrypoints/openai/api_server.py
run_server_worker async ¶
Run a single API server worker.
Source code in vllm/entrypoints/openai/api_server.py
setup_server ¶
Validate API server args, set up signal handler, create socket ready to serve.