Show More
@@ -92,7 +92,7 b' class ParalleMagic(Plugin):' | |||||
92 | Then you can do the following:: |
|
92 | Then you can do the following:: | |
93 |
|
93 | |||
94 | In [24]: %px a = 5 |
|
94 | In [24]: %px a = 5 | |
95 | Parallel execution on engines: all |
|
95 | Parallel execution on engine(s): all | |
96 | Out[24]: |
|
96 | Out[24]: | |
97 | <Results List> |
|
97 | <Results List> | |
98 | [0] In [7]: a = 5 |
|
98 | [0] In [7]: a = 5 | |
@@ -102,7 +102,7 b' class ParalleMagic(Plugin):' | |||||
102 | if self.active_view is None: |
|
102 | if self.active_view is None: | |
103 | print NO_ACTIVE_VIEW |
|
103 | print NO_ACTIVE_VIEW | |
104 | return |
|
104 | return | |
105 | print "Parallel execution on engines: %s" % self.active_view.targets |
|
105 | print "Parallel execution on engine(s): %s" % self.active_view.targets | |
106 | result = self.active_view.execute(parameter_s, block=False) |
|
106 | result = self.active_view.execute(parameter_s, block=False) | |
107 | if self.active_view.block: |
|
107 | if self.active_view.block: | |
108 | result.get() |
|
108 | result.get() | |
@@ -125,9 +125,9 b' class ParalleMagic(Plugin):' | |||||
125 | %autopx to enabled |
|
125 | %autopx to enabled | |
126 |
|
126 | |||
127 | In [26]: a = 10 |
|
127 | In [26]: a = 10 | |
128 | Parallel execution on engines: [0,1,2,3] |
|
128 | Parallel execution on engine(s): [0,1,2,3] | |
129 | In [27]: print a |
|
129 | In [27]: print a | |
130 | Parallel execution on engines: [0,1,2,3] |
|
130 | Parallel execution on engine(s): [0,1,2,3] | |
131 | [stdout:0] 10 |
|
131 | [stdout:0] 10 | |
132 | [stdout:1] 10 |
|
132 | [stdout:1] 10 | |
133 | [stdout:2] 10 |
|
133 | [stdout:2] 10 | |
@@ -174,15 +174,21 b' class ParalleMagic(Plugin):' | |||||
174 | If self.active_view.block is True, wait for the result |
|
174 | If self.active_view.block is True, wait for the result | |
175 | and display the result. Otherwise, this is a noop. |
|
175 | and display the result. Otherwise, this is a noop. | |
176 | """ |
|
176 | """ | |
|
177 | if isinstance(result.stdout, basestring): | |||
|
178 | # single result | |||
|
179 | stdouts = [result.stdout.rstrip()] | |||
|
180 | else: | |||
|
181 | stdouts = [s.rstrip() for s in result.stdout] | |||
|
182 | ||||
177 | targets = self.active_view.targets |
|
183 | targets = self.active_view.targets | |
178 | if isinstance(targets, int): |
|
184 | if isinstance(targets, int): | |
179 | targets = [targets] |
|
185 | targets = [targets] | |
180 | if targets == 'all': |
|
186 | elif targets == 'all': | |
181 | targets = self.active_view.client.ids |
|
187 | targets = self.active_view.client.ids | |
182 | stdout = [s.rstrip() for s in result.stdout] |
|
188 | ||
183 | if any(stdout): |
|
189 | if any(stdouts): | |
184 |
for i, |
|
190 | for eid,stdout in zip(targets, stdouts): | |
185 |
print '[stdout:%i]'%eid, stdout |
|
191 | print '[stdout:%i]'%eid, stdout | |
186 |
|
192 | |||
187 |
|
193 | |||
188 | def pxrun_cell(self, raw_cell, store_history=True): |
|
194 | def pxrun_cell(self, raw_cell, store_history=True): |
@@ -315,6 +315,7 b' class TestView(ClusterTestCase):' | |||||
315 | sys.stdout = savestdout |
|
315 | sys.stdout = savestdout | |
316 | sio.read() |
|
316 | sio.read() | |
317 | self.assertTrue('[stdout:%i]'%v.targets in sio.buf) |
|
317 | self.assertTrue('[stdout:%i]'%v.targets in sio.buf) | |
|
318 | self.assertTrue(sio.buf.rstrip().endswith('10')) | |||
318 | self.assertRaisesRemote(ZeroDivisionError, ip.magic_px, '1/0') |
|
319 | self.assertRaisesRemote(ZeroDivisionError, ip.magic_px, '1/0') | |
319 |
|
320 | |||
320 | def test_magic_px_nonblocking(self): |
|
321 | def test_magic_px_nonblocking(self): |
General Comments 0
You need to be logged in to leave comments.
Login now