From 58ccc239166e7e6f87e60488e62898996f3c52f8 Mon Sep 17 00:00:00 2001 From: Jared Roesch Date: Sat, 23 Dec 2023 01:53:38 +0000 Subject: [PATCH] Fix --- serve/mlc_serve/engine/async_connector.py | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/serve/mlc_serve/engine/async_connector.py b/serve/mlc_serve/engine/async_connector.py index 54d418bd68..794bc759bd 100644 --- a/serve/mlc_serve/engine/async_connector.py +++ b/serve/mlc_serve/engine/async_connector.py @@ -18,27 +18,6 @@ ResultQueue = asyncio.Queue[RequestOutput] -import contextvars -import functools -from asyncio import get_running_loop - -CANCELLATION_EXECUTOR = ThreadPoolExecutor(None) - -async def to_thread_with_cancel_pool(func, /, *args, **kwargs): - """Asynchronously run function *func* in a separate thread. - - Any *args and **kwargs supplied for this function are directly passed - to *func*. Also, the current :class:`contextvars.Context` is propagated, - allowing context variables from the main thread to be accessed in the - separate thread. - - Return a coroutine that can be awaited to get the eventual result of *func*. - """ - loop = get_running_loop() - ctx = contextvars.copy_context() - func_call = functools.partial(ctx.run, func, *args, **kwargs) - return await loop.run_in_executor(CANCELLATION_EXECUTOR, func_call) - class AsyncEngineConnector: def __init__(self, engine: InferenceEngine, engine_wait_timeout=1): self.engine = engine