Skip to content

Conversation

@swkimme
Copy link
Contributor

@swkimme swkimme commented May 31, 2016

What is this PR for?

When notebook has a result with Exceptions, it always fail to import. This PR fix it.

What type of PR is it?

Bug Fix

Todos

  • - Fix this bug by ignore the result with error.

What is the Jira issue?

https://issues.apache.org/jira/browse/ZEPPELIN-905

How should this be tested?

Create notebook with error, then try to import.

Questions:

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

@Leemoonsoo
Copy link
Member

Looks good to me.
How about adding an unittest for it in NotebookTest.java? Let me know if you need help!

@swkimme
Copy link
Contributor Author

swkimme commented May 31, 2016

@Leemoonsoo
I've added some test!

note.getNoteReplLoader().setInterpreters(factory.getDefaultInterpreterSettingList());

final Paragraph p = note.addParagraph();
String simpleText = "hello world";
Copy link
Member

Choose a reason for hiding this comment

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

How about make p.getReturn() returns non InterpreterResult type object here? Then this test can simulate exception when doing InterpreterResult result = gson.fromJson(resultJson, InterpreterResult.class);

I think easiest way to set arbitrary object to Job.result is making Job.setResult() public.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Leemoonsoo I cannot agree that's the best way to do that..
What if we change type of Job.result into InterpreterResult ?

Copy link
Member

Choose a reason for hiding this comment

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

@swkimme
I was trying to say, the test doesn't test import note when p.getReturn() is String.
However this unittest is still good, too. Anyway we didn't have test for import/export function.

About changing Job.result into InterpreterResult, we'll need to consider import note.json created from previous version of Zeppelin. They'll still have Job.result with string type.

@swkimme
Copy link
Contributor Author

swkimme commented May 31, 2016

@Leemoonsoo Do you know why the CI test failed btw?

@prabhjyotsingh
Copy link
Contributor

@swkimme I think this is failing because you are trying to get paragraph result i.e. p.getResult() or p2.getResult() without running any of the paragraph.

try having

note.runAll();
while(p.isTerminated()==false || p.getResult()==null) Thread.yield();

importedNote.runAll();
while(p2.isTerminated()==false || p2.getResult()==null) Thread.yield();

String resultJson = gson.toJson(srcParagraph.getReturn());
InterpreterResult result = gson.fromJson(resultJson, InterpreterResult.class);
newParagraph.setReturn(result, null);
} catch (Exception e) { /* ignore */ }
Copy link
Member

@bzz bzz Jun 1, 2016

Choose a reason for hiding this comment

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

A nitpick, but may be we could leave some clues for the person who is going to read it next time.

Instead of stating the fact that we are ignoring exception, we could write the reason or case when\why it happens to be OK to do so i.e

// ignore case when  'result' part of Note consists of exception, instead of actual interpreter results

would make sense, how do you think?

Copy link
Member

Choose a reason for hiding this comment

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

and, I think we should log the exception

@swkimme
Copy link
Contributor Author

swkimme commented Jun 3, 2016

@bzz @felixcheung Good idea, updated log and comment!

} catch (Exception e) { /* ignore */ }
} catch (Exception e) {
// 'result' part of Note consists of exception, instead of actual interpreter results
logger.info("Paragraph " + srcParagraph.getId() + " has a result with exception.");
Copy link
Member

Choose a reason for hiding this comment

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

could you ether logger.error() or getStackTrace like here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The exception and message is quite clear so I don't think we do not need trace, then I'm adding the error message!

@bzz
Copy link
Member

bzz commented Jun 15, 2016

do you think it's ready to be merged now? I belive there was some feedback from @Leemoonsoo as well

As for CI failure - it seems like flaky ZeppelinIT.testSparkInterpreterDependencyLoading:243 so would you mind rebasing on latest master please?

@bzz
Copy link
Member

bzz commented Jun 16, 2016

@swkimme ping on the status of this patch

asfgit pushed a commit that referenced this pull request Jun 23, 2016
### What is this PR for?
This PR is fixing import/clone notebook with error result. This PR adds test based on #933.
> Note: This issue is one of the [blockers](https://issues.apache.org/jira/browse/ZEPPELIN-889) of 0.6.0 release so should be merged into branch-0.6 before release.

### What type of PR is it?
Bug Fix

### What is the Jira issue?
[ZEPPELIN-905](https://issues.apache.org/jira/browse/ZEPPELIN-905)

### How should this be tested?
When you try to import or clone notebook with error result, it should work.

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

Author: Kevin Kim <[email protected]>
Author: Mina Lee <[email protected]>

Closes #1043 from minahlee/ZEPPELIN-905 and squashes the following commits:

69b8c02 [Mina Lee] Add test for clone notebook with String type result
e7af919 [Kevin Kim] stylish code
7bf5d01 [Kevin Kim] log info -> warn, add message
d4f6699 [Kevin Kim] log exception
32949bc [Kevin Kim] trigger CI build
803e08a [Kevin Kim] revert implementation
c13293f [Kevin Kim] fix test, better implementation
1e45a9e [Kevin Kim] [ZEPPELIN-905] add test
a4188be [Kevin Kim] [ZEPPELIN-905] fix failed notebook import bug
asfgit pushed a commit that referenced this pull request Jun 23, 2016
### What is this PR for?
This PR is fixing import/clone notebook with error result. This PR adds test based on #933.
> Note: This issue is one of the [blockers](https://issues.apache.org/jira/browse/ZEPPELIN-889) of 0.6.0 release so should be merged into branch-0.6 before release.

### What type of PR is it?
Bug Fix

### What is the Jira issue?
[ZEPPELIN-905](https://issues.apache.org/jira/browse/ZEPPELIN-905)

### How should this be tested?
When you try to import or clone notebook with error result, it should work.

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

Author: Kevin Kim <[email protected]>
Author: Mina Lee <[email protected]>

Closes #1043 from minahlee/ZEPPELIN-905 and squashes the following commits:

69b8c02 [Mina Lee] Add test for clone notebook with String type result
e7af919 [Kevin Kim] stylish code
7bf5d01 [Kevin Kim] log info -> warn, add message
d4f6699 [Kevin Kim] log exception
32949bc [Kevin Kim] trigger CI build
803e08a [Kevin Kim] revert implementation
c13293f [Kevin Kim] fix test, better implementation
1e45a9e [Kevin Kim] [ZEPPELIN-905] add test
a4188be [Kevin Kim] [ZEPPELIN-905] fix failed notebook import bug

(cherry picked from commit 50db175)
Signed-off-by: Mina Lee <[email protected]>
@asfgit asfgit closed this in 0209bc3 Jun 26, 2016
Sign up for free to 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.

5 participants