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