Skip to content

ZEPPELIN-1293. Livy Interpreter: Automatically attach or create to a new session - #1861

Closed
zjffdu wants to merge 3 commits into
apache:masterfrom
zjffdu:ZEPPELIN-1293
Closed

ZEPPELIN-1293. Livy Interpreter: Automatically attach or create to a new session#1861
zjffdu wants to merge 3 commits into
apache:masterfrom
zjffdu:ZEPPELIN-1293

Conversation

@zjffdu

@zjffduzjffdu commented Jan 6, 2017

Copy link
Copy Markdown
Contributor

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?

How should this be tested?

Tested manually.
image

Screenshots (if appropriate)

Questions:

  • Does the licenses files need update? No
  • Is there breaking changes for older versions? No
  • Does this needs documentation? No

@zjffdu

Copy link
Copy Markdown
ContributorAuthor

@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.*;

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
ContributorAuthor

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;

Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
ContributorAuthor

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>");

Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
ContributorAuthor

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

@zjffdu

Copy link
Copy Markdown
ContributorAuthor

@felixcheung I have addressed the comments and also fix one bug in LivySparkSQLInterpreter, and update the screenshot of testing in PR description.

@prabhjyotsingh

Copy link
Copy Markdown
Contributor

Tested locally, looks good.

resMsg.append("\n");
if (rows[3].indexOf("+") == 0) {

} else {

Copy link
Copy Markdown
Member

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 {

Copy link
Copy Markdown
ContributorAuthor

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.

@felixcheung

Copy link
Copy Markdown
Member

LGTM.
what is the bug in LivySparkSQLInterpreter - should we have a JIRA for it?

@zjffdu

zjffdu commented Jan 10, 2017

Copy link
Copy Markdown
ContributorAuthor

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.

@zjffdu

Copy link
Copy Markdown
ContributorAuthor

ping @felixcheung any more comments ?

@felixcheung

Copy link
Copy Markdown
Member

nope,
merging if no more comment

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>");

Copy link
Copy Markdown
Member

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 !

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, addressed.

@felixcheung

Copy link
Copy Markdown
Member

merging if no more comment

asfgit pushed a commit that referenced this pull request Jan 14, 2017
…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.
![image](https://cloud.githubusercontent.com/assets/164491/21761175/2473c0c0-d68c-11e6-8f39-9e87333c6168.png)
### 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 <zjffdu@apache.org>
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
@zjffdu

Copy link
Copy Markdown
ContributorAuthor

@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.

@zjffdu

zjffdu commented Jan 17, 2017

Copy link
Copy Markdown
ContributorAuthor

@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.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@zjffdu@prabhjyotsingh@felixcheung