MCPcopy
hub / github.com/Bogdanp/dramatiq / start

Method start

dramatiq/asyncio.py:94–111  ·  view source on GitHub ↗

Starts the event loop thread. Parameters: timeout: The maximum amount of time (in seconds) to wait for the event loop to start. Raises: RuntimeError: If called more than once on the same thread value.

(self, *, timeout: Optional[float] = None)

Source from the content-addressed store, hash-verified

92 self.loop.close()
93
94 def start(self, *, timeout: Optional[float] = None):
95 """Starts the event loop thread.
96
97 Parameters:
98 timeout: The maximum amount of time (in seconds) to wait for
99 the event loop to start.
100
101 Raises:
102 RuntimeError: If called more than once on the same thread
103 value.
104 """
105 super().start()
106
107 ready = threading.Event()
108 self.loop.call_soon_threadsafe(ready.set)
109 if not ready.wait(timeout=timeout):
110 raise RuntimeError("Event loop failed to start.")
111 self.logger.info("Event loop is running.")
112
113 def stop(self):
114 if self.loop.is_running():

Callers 4

before_worker_bootMethod · 0.95
started_threadFunction · 0.95

Calls 1

waitMethod · 0.45

Tested by 3

started_threadFunction · 0.76