Show More
@@ -144,35 +144,37 b' class RemoteMultiEngine(RemoteContextBase):' | |||||
144 |
|
144 | |||
145 |
|
145 | |||
146 | # XXX - Temporary hackish testing, we'll move this into proper tests right |
|
146 | # XXX - Temporary hackish testing, we'll move this into proper tests right | |
147 | # away |
|
147 | # away. This has been commented out as it doesn't run under Python 2.4 | |
148 |
|
148 | # because of the usage of the with statement below. We need to protect | ||
149 | if __name__ == '__main__': |
|
149 | # such things with a try:except. | |
150 |
|
150 | |||
151 | # XXX - for now, we need a running cluster to be started separately. The |
|
151 | # if __name__ == '__main__': | |
152 | # daemon work is almost finished, and will make much of this unnecessary. |
|
152 | # | |
153 | from IPython.kernel import client |
|
153 | # # XXX - for now, we need a running cluster to be started separately. The | |
154 | mec = client.MultiEngineClient(('127.0.0.1',10105)) |
|
154 | # # daemon work is almost finished, and will make much of this unnecessary. | |
155 |
|
155 | # from IPython.kernel import client | ||
156 | try: |
|
156 | # mec = client.MultiEngineClient(('127.0.0.1',10105)) | |
157 | mec.get_ids() |
|
157 | # | |
158 | except ConnectionRefusedError: |
|
158 | # try: | |
159 | import os, time |
|
159 | # mec.get_ids() | |
160 | os.system('ipcluster -n 2 &') |
|
160 | # except ConnectionRefusedError: | |
161 | time.sleep(2) |
|
161 | # import os, time | |
162 | mec = client.MultiEngineClient(('127.0.0.1',10105)) |
|
162 | # os.system('ipcluster -n 2 &') | |
163 |
|
163 | # time.sleep(2) | ||
164 | mec.block = False |
|
164 | # mec = client.MultiEngineClient(('127.0.0.1',10105)) | |
165 |
|
165 | # | ||
166 | import itertools |
|
166 | # mec.block = False | |
167 | c = itertools.count() |
|
167 | # | |
168 |
|
168 | # import itertools | ||
169 | parallel = RemoteMultiEngine(mec) |
|
169 | # c = itertools.count() | |
170 |
|
170 | # | ||
171 | with parallel as pr: |
|
171 | # parallel = RemoteMultiEngine(mec) | |
172 | # A comment |
|
172 | # | |
173 | remote() # this means the code below only runs remotely |
|
173 | # with parallel as pr: | |
174 | print 'Hello remote world' |
|
174 | # # A comment | |
175 | x = 3.14 |
|
175 | # remote() # this means the code below only runs remotely | |
176 | # Comments are OK |
|
176 | # print 'Hello remote world' | |
177 | # Even misindented. |
|
177 | # x = 3.14 | |
178 | y = x+1 |
|
178 | # # Comments are OK | |
|
179 | # # Even misindented. | |||
|
180 | # y = x+1 |
General Comments 0
You need to be logged in to leave comments.
Login now