| 14 | class InteractiveMPIConsole(code.InteractiveConsole): |
| 15 | # Function copied from /usr/lib/python3.4/code.py line 38 |
| 16 | def runsource(self, source, filename="<input>", symbol="single"): |
| 17 | try: |
| 18 | compiled_code = self.compile(source, filename, symbol) |
| 19 | except (OverflowError, SyntaxError, ValueError): |
| 20 | # Case 1 |
| 21 | self.showsyntaxerror(filename) |
| 22 | return False |
| 23 | |
| 24 | if compiled_code is None: |
| 25 | # Case 2 |
| 26 | return True |
| 27 | |
| 28 | # Case 3 -- first send code to other mpi processes |
| 29 | ngmpi.SendCommand('ngs_py '+source) |
| 30 | # then run it on master |
| 31 | code.InteractiveConsole.runcode(self, compiled_code) |
| 32 | |
| 33 | # Avoid the prompt to show up before other processes' output |
| 34 | self.Barrier() |
| 35 | return False |
| 36 | |
| 37 | def interact(self): |
| 38 | import sys |