MCPcopy Index your code
hub / github.com/dabeaz/python-cookbook / Worker

Class Worker

src/12/defining_an_actor_task/worker.py:17–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15 return self._result
16
17class Worker(Actor):
18 def submit(self, func, *args, **kwargs):
19 r = Result()
20 self.send((func, args, kwargs, r))
21 return r
22
23 def run(self):
24 while True:
25 func, args, kwargs, r = self.recv()
26 r.set_result(func(*args, **kwargs))
27
28# Example use
29if __name__ == '__main__':

Callers 1

worker.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected