MCPcopy Create free account
hub / github.com/BerriAI/litellm / loop

Method loop

litellm/harness/sync.py:53–63  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

51 self._thread: threading.Thread | None = None
52
53 def loop(self) -> asyncio.AbstractEventLoop:
54 with self._lock:
55 if self._loop is None or self._thread is None or not self._thread.is_alive():
56 self._loop = asyncio.new_event_loop()
57 self._thread = threading.Thread(
58 target=self._loop.run_forever,
59 name="litellm-harness-loop",
60 daemon=True,
61 )
62 self._thread.start()
63 return self._loop
64
65 def submit(self, coro: Coroutine[object, None, T]) -> Future[T]:
66 return asyncio.run_coroutine_threadsafe(coro, self.loop())

Callers 3

submitMethod · 0.95
cancelMethod · 0.80

Calls 1

startMethod · 0.45

Tested by 1