Show More
@@ -48,7 +48,7 b' def strip_whitespace(source,require_remote=True):' | |||||
48 | """strip leading whitespace from input source. |
|
48 | """strip leading whitespace from input source. | |
49 |
|
49 | |||
50 | :Parameters: |
|
50 | :Parameters: | |
51 |
|
51 | |||
52 | """ |
|
52 | """ | |
53 | remote_mark = 'remote()' |
|
53 | remote_mark = 'remote()' | |
54 | # Expand tabs to avoid any confusion. |
|
54 | # Expand tabs to avoid any confusion. | |
@@ -101,7 +101,7 b' def strip_whitespace(source,require_remote=True):' | |||||
101 | class RemoteContextBase(object): |
|
101 | class RemoteContextBase(object): | |
102 | def __init__(self): |
|
102 | def __init__(self): | |
103 | self.ip = ipapi.get() |
|
103 | self.ip = ipapi.get() | |
104 |
|
104 | |||
105 | def _findsource_file(self,f): |
|
105 | def _findsource_file(self,f): | |
106 | linecache.checkcache() |
|
106 | linecache.checkcache() | |
107 | s = findsource(f.f_code) |
|
107 | s = findsource(f.f_code) | |
@@ -113,10 +113,10 b' class RemoteContextBase(object):' | |||||
113 | from IPython import ipapi |
|
113 | from IPython import ipapi | |
114 | self.ip = ipapi.get() |
|
114 | self.ip = ipapi.get() | |
115 | buf = self.ip.IP.input_hist_raw[-1].splitlines()[1:] |
|
115 | buf = self.ip.IP.input_hist_raw[-1].splitlines()[1:] | |
116 |
wsource = [l+'\n' for l in buf ] |
|
116 | wsource = [l+'\n' for l in buf ] | |
117 |
|
117 | |||
118 | return strip_whitespace(wsource) |
|
118 | return strip_whitespace(wsource) | |
119 |
|
119 | |||
120 | def findsource(self,frame): |
|
120 | def findsource(self,frame): | |
121 | local_ns = frame.f_locals |
|
121 | local_ns = frame.f_locals | |
122 | global_ns = frame.f_globals |
|
122 | global_ns = frame.f_globals | |
@@ -128,7 +128,7 b' class RemoteContextBase(object):' | |||||
128 |
|
128 | |||
129 | def __enter__(self): |
|
129 | def __enter__(self): | |
130 | raise NotImplementedError |
|
130 | raise NotImplementedError | |
131 |
|
131 | |||
132 | def __exit__ (self, etype, value, tb): |
|
132 | def __exit__ (self, etype, value, tb): | |
133 | if issubclass(etype,error.StopLocalExecution): |
|
133 | if issubclass(etype,error.StopLocalExecution): | |
134 | return True |
|
134 | return True | |
@@ -168,6 +168,8 b" if __name__ == '__main__':" | |||||
168 |
|
168 | |||
169 | parallel = RemoteMultiEngine(mec) |
|
169 | parallel = RemoteMultiEngine(mec) | |
170 |
|
170 | |||
|
171 | mec.pushAll() | |||
|
172 | ||||
171 | with parallel as pr: |
|
173 | with parallel as pr: | |
172 | # A comment |
|
174 | # A comment | |
173 | remote() # this means the code below only runs remotely |
|
175 | remote() # this means the code below only runs remotely |
General Comments 0
You need to be logged in to leave comments.
Login now