-
Notifications
You must be signed in to change notification settings - Fork 2.8k
ZEPPELIN-1293. Livy Interpreter: Automatically attach or create to a new session #1861
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
|
@prabhjyotsingh @felixcheung Please help review. |
| import org.apache.zeppelin.interpreter.InterpreterContext; | ||
| import org.apache.zeppelin.interpreter.InterpreterResult; | ||
| import org.apache.zeppelin.interpreter.InterpreterUtils; | ||
| import org.apache.zeppelin.interpreter.*; |
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.
what's our coding style guide on multiple imports? is it clearer to list them out
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.
This is done by intellij which would use * when imports more than 5 classes in one package. I think it should be fine to do that.
| stmtInfo = executeStatement(new ExecuteRequest(code)); | ||
| } catch (SessionNotFoundException e) { | ||
| LOGGER.warn("Livy session {} is expired, new session will be created.", sessionInfo.id); | ||
| this.sessionExpired = true; |
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.
instead of saving this as a state, would be more self-contain to pass this as a flag to appendSessionExpire below?
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.
Good idea !
| result2.add(message.getType(), message.getData()); | ||
| } | ||
| result2.add(InterpreterResult.Type.HTML, | ||
| "<hr/><font color=\"red\">Previous session is expired, new session is created.</font>"); |
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.
perhaps it is better for this message to be at the top of the result output, rather than at the bottom of it? doesn't it require the user to scroll down if he has a long output?
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.
hmm, make sense to put it at the top
|
@felixcheung I have addressed the comments and also fix one bug in LivySparkSQLInterpreter, and update the screenshot of testing in PR description. |
|
Tested locally, looks good. |
| resMsg.append("\n"); | ||
| if (rows[3].indexOf("+") == 0) { | ||
|
|
||
| } else { |
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.
this exists before, but this construct is a bit strange?
if (rows[3].indexOf("+") == 0) {
} else {
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.
I don't know about this logic, @prabhjyotsingh is the original author who might know this.
|
LGTM. |
|
The bug in LivySparkSQLInterpreter is caused by this PR and fixed in this PR. LivySparkSQLInterpreter delegate LivySparkInterpreter to generate InterpreterResult and then convert it to table type. So here since we make it as multiple InterpreterResult, we should only convert the InterpreterMessage with text type that is for sql output. |
|
ping @felixcheung any more comments ? |
|
nope, |
| result2.add(InterpreterResult.Type.HTML, | ||
| "<font color=\"red\">Previous session is expired, new session is created.</font>"); | ||
| "<font color=\"red\">Previous session is expired, new session is created. " + | ||
| "Paragraphes that depend on this paragraph need to be re-executed !" + "</font>"); |
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.
I think it should be Paragraphs. Also, let remove the space before !
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.
Thanks, addressed.
|
merging if no more comment |
…new session ### What is this PR for? By default, livy session will expire after one hour. This PR would create session automatically for user if session is expired, and would also display the session expire information in frontend. The expire message would only display at the first time of session recreation, after that the message won't be displayed. ### What type of PR is it? [Improvement ] ### Todos * [ ] - Task ### What is the Jira issue? * https://issues.apache.org/jira/browse/ZEPPELIN-1293 ### How should this be tested? Tested manually.  ### Screenshots (if appropriate) ### Questions: * Does the licenses files need update? No * Is there breaking changes for older versions? No * Does this needs documentation? No Author: Jeff Zhang <[email protected]> Closes #1861 from zjffdu/ZEPPELIN-1293 and squashes the following commits: e174593 [Jeff Zhang] minor update on warning message 30c3569 [Jeff Zhang] address comments 88f0d9a [Jeff Zhang] ZEPPELIN-1293. Livy Interpreter: Automatically attach or create to a new session
|
@felixcheung @minahlee Could any of you help to merge it into branch-0.7 as well ? Since this is only livy interpreter specific, so I don't think it would affect the 0.7 release. |
|
@felixcheung @minahlee , Sorry my mistake, It has been merged into branch-0.7. @minahlee I notice you make the jira fixversion as 0.8, I add 0.7 as well. |
What is this PR for?
By default, livy session will expire after one hour. This PR would create session automatically for user if session is expired, and would also display the session expire information in frontend. The expire message would only display at the first time of session recreation, after that the message won't be displayed.
What type of PR is it?
[Improvement ]
Todos
What is the Jira issue?
How should this be tested?
Tested manually.

Screenshots (if appropriate)
Questions: