Show More
@@ -0,0 +1,39 b'' | |||
|
1 | #def test_simple(): | |
|
2 | if 0: | |
|
3 | ||
|
4 | # XXX - for now, we need a running cluster to be started separately. The | |
|
5 | # daemon work is almost finished, and will make much of this unnecessary. | |
|
6 | from IPython.kernel import client | |
|
7 | mec = client.MultiEngineClient(('127.0.0.1',10105)) | |
|
8 | ||
|
9 | try: | |
|
10 | mec.get_ids() | |
|
11 | except ConnectionRefusedError: | |
|
12 | import os, time | |
|
13 | os.system('ipcluster -n 2 &') | |
|
14 | time.sleep(2) | |
|
15 | mec = client.MultiEngineClient(('127.0.0.1',10105)) | |
|
16 | ||
|
17 | mec.block = False | |
|
18 | ||
|
19 | import itertools | |
|
20 | c = itertools.count() | |
|
21 | ||
|
22 | parallel = RemoteMultiEngine(mec) | |
|
23 | ||
|
24 | mec.pushAll() | |
|
25 | ||
|
26 | with parallel as pr: | |
|
27 | # A comment | |
|
28 | remote() # this means the code below only runs remotely | |
|
29 | print 'Hello remote world' | |
|
30 | x = range(10) | |
|
31 | # Comments are OK | |
|
32 | # Even misindented. | |
|
33 | y = x+1 | |
|
34 | ||
|
35 | ||
|
36 | with pfor('i',sequence) as pr: | |
|
37 | print x[i] | |
|
38 | ||
|
39 | print pr.x + pr.y |
General Comments 0
You need to be logged in to leave comments.
Login now