Skip to content

Commit 2a6ab5f

Browse files
committed
fix
1 parent 53d0827 commit 2a6ab5f

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

examples/tensorrt_llm/common/utils.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525

2626
logger = logging.getLogger(__name__)
2727

28+
AsyncTask = Union[Callable[..., Coroutine[Any, Any, bool]], weakref.WeakMethod]
29+
2830

2931
class RoutingStrategy(Enum):
3032
ROUND_ROBIN = "round_robin"
@@ -54,9 +56,7 @@ class ConversationMessage(TypedDict):
5456
class ManagedThread(threading.Thread):
5557
def __init__(
5658
self,
57-
task: Optional[
58-
Union[Callable[..., Coroutine[Any, Any, bool]], weakref.WeakMethod]
59-
],
59+
task: Optional[AsyncTask],
6060
error_queue: Optional[Queue] = None,
6161
name: Optional[str] = None,
6262
loop: Optional[asyncio.AbstractEventLoop] = None,
@@ -76,9 +76,7 @@ def set_loop(self, loop: asyncio.AbstractEventLoop):
7676

7777
def run(self):
7878
while not self.stop_event.is_set():
79-
task: Optional[
80-
Union[Callable[..., Coroutine[Any, Any, bool]], weakref.WeakMethod]
81-
] = self.task
79+
task: Optional[AsyncTask] = self.task
8280
if isinstance(task, weakref.WeakMethod):
8381
task = task()
8482
if task is None:

0 commit comments

Comments
 (0)