Instances of this class process iterators in separate processes.
Definition at line 27 of file MpUtils.py.
◆ __init__()
def python.MpUtils.SubProcessIterator.__init__ |
( |
|
self, |
|
|
|
itertask, |
|
|
|
eoi = '__eoi__' |
|
) |
| |
Create a new subprocess iterator.
itertask : some iterable task to execute in a subprocess
eoi : an end-of-iteration marker - returned from the subprocess
to signal that iteration is complete.
Definition at line 29 of file MpUtils.py.
29 def __init__(self, itertask, eoi='__eoi__'):
30 """Create a new subprocess iterator.
32 itertask : some iterable task to execute in a subprocess
33 eoi : an end-of-iteration marker - returned from the subprocess
34 to signal that iteration is complete.
36 self.client, self.master = Pipe()
37 self.end_of_input = eoi
38 pargs = [itertask, self.master, eoi]
39 self.process = Process(target=self.work, args=pargs)
◆ __iter__()
def python.MpUtils.SubProcessIterator.__iter__ |
( |
|
self | ) |
|
◆ _empty()
def python.MpUtils.SubProcessIterator._empty |
( |
|
self, |
|
|
* |
args, |
|
|
** |
params |
|
) |
| |
|
private |
Definition at line 66 of file MpUtils.py.
66 def _empty(self, *args, **params):
◆ _start()
def python.MpUtils.SubProcessIterator._start |
( |
|
self | ) |
|
|
private |
◆ next()
def python.MpUtils.SubProcessIterator.next |
( |
|
self | ) |
|
Definition at line 58 of file MpUtils.py.
59 item = self.client.recv()
60 if item != self.end_of_input:
63 self.next = self._empty
◆ work()
def python.MpUtils.SubProcessIterator.work |
( |
|
iterator, |
|
|
|
master, |
|
|
|
eoi |
|
) |
| |
|
static |
The actual callable that is executed in the subprocess.
Definition at line 47 of file MpUtils.py.
47 def work(iterator, master, eoi):
48 """The actual callable that is executed in the subprocess."""
49 for chunk
in iterator:
◆ end_of_input
python.MpUtils.SubProcessIterator.end_of_input |
◆ master
python.MpUtils.SubProcessIterator.master |
◆ next
python.MpUtils.SubProcessIterator.next |
◆ process
python.MpUtils.SubProcessIterator.process |
◆ started
python.MpUtils.SubProcessIterator.started |
The documentation for this class was generated from the following file: