This class (concurrently) runs instances of EventLoop.
An instance of this class needs to be initialized with a communication channel with workers that actually run the EventLoop:
runner = MPEventLoopRunner(communicationChannel)
An example of a communication channel is an instance of CommunicationChannel.
The method begin() does nothing in the current version:
In older versions, multiple processes are forked in this method.
Then, you can give an EventLoop with the method run():
This class will send the EventLoop to a worker through the communication channel. The worker, then, runs the EventLoop.
You can call the method run() mutiple times:
runner.run(eventLoop2) runner.run(eventLoop3) runner.run(eventLoop4)
If workers are in the background, this method immediately returns. Worker are concurrently running the event loops in the background. If the worker is in the foreground, this method won’t return until the worker finishes running the event loop. Whether workers are in the background or foreground depends on the communication channel with which this class is initialized.
After giving all event loops that you need to run to this class, you need to call the method end():
results = runner.end()
If workers are in the background, this method will wait until workers finish running all event loops. If the worker is in the foreground, this method immediately returns. This method returns the results, the list of the values eventLoops return, sorted in the order given with run().
Initialize self. See help(type(self)) for accurate signature.
wait until all event loops end and returns the results.
Return pairs of run ids and results of finish event loops.
Return pairs of run ids and results.
Return a pair of a run id and a result.
run the event loop in the background.
run the event loops in the background.