-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[Zeppelin-1555] Eliminate prefix in PythonInterpreter exception #1530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| if (line.equals("...")) { | ||
| logger.warn("Syntax error ! "); | ||
| output.append("Syntax error ! "); | ||
| break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
break here could cause chaos afterwards.
|
cc @zjffdu |
|
Thank you for contributing! How do you think, how hard would be to add some tests here, to make sure the change does not break things? |
|
@bzz Thanks for the quick response! I will write and update some tests for this to make sure the changes doesn't break things before. |
|
@bzz I have updated and added unit test. |
|
Tested and Looks great to me! Thanks @vectorijk for the contribution! |
|
Merge if there're no more discussions |
|
@Leemoonsoo @bzz Thanks for the review! |
### What is this PR for? Solve bug metioned [here](https://github.com/apache/zeppelin/blob/3dec4d7006b8a57136f34ae330ba937d8990f2d2/python/src/main/java/org/apache/zeppelin/python/PythonInterpreter.java#L139) Since we launch python interpreter as a process and redirect stdin and stdout, only exception occurred (like syntax error or indentation error, etc) could give string like `...`. Thus, we don't need to determine whether syntax error happened in [`PythonProcess.sendAndGetResult`](https://github.com/apache/zeppelin/blob/3dec4d7006b8a57136f34ae330ba937d8990f2d2/python/src/main/java/org/apache/zeppelin/python/PythonProcess.java#L86) because we have detected error in [`PythonInterpreter.pythonErrorIn`](https://github.com/apache/zeppelin/blob/3dec4d7006b8a57136f34ae330ba937d8990f2d2/python/src/main/java/org/apache/zeppelin/python/PythonInterpreter.java#L152) ### What type of PR is it? Bug Fix ### What is the Jira issue? Jira: https://issues.apache.org/jira/browse/ZEPPELIN-1555 ### How should this be tested? Test locally. ### Screenshots <img width="1175" alt="screen shot 2016-10-16 at 18 05 00" src="https://cloud.githubusercontent.com/assets/3419881/19422552/192a8b3a-93cb-11e6-89e8-63f2652a7f85.png"> ### Questions: * Does the licenses files need update? No * Is there breaking changes for older versions? No * Does this needs documentation? No Author: Kai Jiang <[email protected]> Closes apache#1530 from vectorijk/zeppelin-1555 and squashes the following commits: 8ffc360 [Kai Jiang] add unit test d7a2ef4 [Kai Jiang] [zeppelin-1555] Eliminate prefix in PythonInterpreter exception
### What is this PR for? Solve bug metioned [here](https://github.com/apache/zeppelin/blob/3dec4d7006b8a57136f34ae330ba937d8990f2d2/python/src/main/java/org/apache/zeppelin/python/PythonInterpreter.java#L139) Since we launch python interpreter as a process and redirect stdin and stdout, only exception occurred (like syntax error or indentation error, etc) could give string like `...`. Thus, we don't need to determine whether syntax error happened in [`PythonProcess.sendAndGetResult`](https://github.com/apache/zeppelin/blob/3dec4d7006b8a57136f34ae330ba937d8990f2d2/python/src/main/java/org/apache/zeppelin/python/PythonProcess.java#L86) because we have detected error in [`PythonInterpreter.pythonErrorIn`](https://github.com/apache/zeppelin/blob/3dec4d7006b8a57136f34ae330ba937d8990f2d2/python/src/main/java/org/apache/zeppelin/python/PythonInterpreter.java#L152) ### What type of PR is it? Bug Fix ### What is the Jira issue? Jira: https://issues.apache.org/jira/browse/ZEPPELIN-1555 ### How should this be tested? Test locally. ### Screenshots <img width="1175" alt="screen shot 2016-10-16 at 18 05 00" src="https://cloud.githubusercontent.com/assets/3419881/19422552/192a8b3a-93cb-11e6-89e8-63f2652a7f85.png"> ### Questions: * Does the licenses files need update? No * Is there breaking changes for older versions? No * Does this needs documentation? No Author: Kai Jiang <[email protected]> Closes apache#1530 from vectorijk/zeppelin-1555 and squashes the following commits: 8ffc360 [Kai Jiang] add unit test d7a2ef4 [Kai Jiang] [zeppelin-1555] Eliminate prefix in PythonInterpreter exception
What is this PR for?
Solve bug metioned here
Since we launch python interpreter as a process and redirect stdin and stdout, only exception occurred (like syntax error or indentation error, etc) could give string like
.... Thus, we don't need to determine whether syntax error happened inPythonProcess.sendAndGetResultbecause we have detected error inPythonInterpreter.pythonErrorInWhat type of PR is it?
Bug Fix
What is the Jira issue?
Jira: https://issues.apache.org/jira/browse/ZEPPELIN-1555
How should this be tested?
Test locally.
Screenshots

### Questions: - Does the licenses files need update? No - Is there breaking changes for older versions? No - Does this needs documentation? No