Show More
@@ -656,7 +656,7 b' class DirectView(View):' | |||||
656 | # applier = self.apply_sync if block else self.apply_async |
|
656 | # applier = self.apply_sync if block else self.apply_async | |
657 | if not isinstance(ns, dict): |
|
657 | if not isinstance(ns, dict): | |
658 | raise TypeError("Must be a dict, not %s"%type(ns)) |
|
658 | raise TypeError("Must be a dict, not %s"%type(ns)) | |
659 |
return self._really_apply(util._push, |
|
659 | return self._really_apply(util._push, kwargs=ns, block=block, track=track, targets=targets) | |
660 |
|
660 | |||
661 | def get(self, key_s): |
|
661 | def get(self, key_s): | |
662 | """get object(s) by `key_s` from remote namespace |
|
662 | """get object(s) by `key_s` from remote namespace |
@@ -233,6 +233,23 b' class TestView(ClusterTestCase):' | |||||
233 | view.scatter('a', a) |
|
233 | view.scatter('a', a) | |
234 | b = view.gather('a', block=True) |
|
234 | b = view.gather('a', block=True) | |
235 | assert_array_equal(b, a) |
|
235 | assert_array_equal(b, a) | |
|
236 | ||||
|
237 | @skip_without('numpy') | |||
|
238 | def test_push_numpy_nocopy(self): | |||
|
239 | import numpy | |||
|
240 | view = self.client[:] | |||
|
241 | a = numpy.arange(64) | |||
|
242 | view['A'] = a | |||
|
243 | @interactive | |||
|
244 | def check_writeable(x): | |||
|
245 | return x.flags.writeable | |||
|
246 | ||||
|
247 | for flag in view.apply_sync(check_writeable, pmod.Reference('A')): | |||
|
248 | self.assertFalse(flag, "array is writeable, push shouldn't have pickled it") | |||
|
249 | ||||
|
250 | view.push(dict(B=a)) | |||
|
251 | for flag in view.apply_sync(check_writeable, pmod.Reference('B')): | |||
|
252 | self.assertFalse(flag, "array is writeable, push shouldn't have pickled it") | |||
236 |
|
253 | |||
237 | @skip_without('numpy') |
|
254 | @skip_without('numpy') | |
238 | def test_apply_numpy(self): |
|
255 | def test_apply_numpy(self): |
@@ -355,7 +355,7 b' def interactive(f):' | |||||
355 | return f |
|
355 | return f | |
356 |
|
356 | |||
357 | @interactive |
|
357 | @interactive | |
358 | def _push(ns): |
|
358 | def _push(**ns): | |
359 | """helper method for implementing `client.push` via `client.apply`""" |
|
359 | """helper method for implementing `client.push` via `client.apply`""" | |
360 | globals().update(ns) |
|
360 | globals().update(ns) | |
361 |
|
361 |
General Comments 0
You need to be logged in to leave comments.
Login now