Skip to content

[ZEPPELIN-4981]. Zeppelin Client API - #3887

Closed
zjffdu wants to merge 19 commits into
apache:masterfrom
zjffdu:ZEPPELIN-4981
Closed

[ZEPPELIN-4981]. Zeppelin Client API#3887
zjffdu wants to merge 19 commits into
apache:masterfrom
zjffdu:ZEPPELIN-4981

Conversation

@zjffdu

@zjffduzjffdu commented Aug 23, 2020

Copy link
Copy Markdown
Contributor

What is this PR for?

This is the initial PR fo introducing zeppelin client api. You can check this google doc for the overall design. https://docs.google.com/document/d/1bLLKKxleZlZpP9EFJlLLkJKwDBps-RNvzNwh3LFZWZ4/edit?usp=sharing
In this PR, I add 2 modules: zeppelin-client, zeppelin-client-examples.

You can take a look at the module zeppelin-client-examples to see how we can use zeppelin client api.

What type of PR is it?

[ Feature ]

Todos

  • - Task

What is the Jira issue?

How should this be tested?

  • Manually tested and Unit test is added.

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
zjffduforce-pushed the ZEPPELIN-4981 branch 9 times, most recently from 9d366ad to 8f9e129CompareAugust 30, 2020 06:48
@zjffdu
zjffduforce-pushed the ZEPPELIN-4981 branch 7 times, most recently from e8d3eb7 to 8391a94CompareSeptember 2, 2020 06:20

@ReamerReamer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

First, I think this is a very big PR, and I hope that some others will also review this PR. Overall it seems to be really good. I see that the library unirest-java did the communication, this library seems useful.

I have seen that you catch all/most API Exceptions (example)
I think it is better to use an ExceptionMapper. If not, then you should remove the `throws' declaration.

* @throws Exception
*/
private void checkResponse(HttpResponse<JsonNode> response) throws Exception {
if (response.getStatus() == 302) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

302 is the answer to a redirection. 401 is the status code for Unauthorized. Are we responding with an incorrect status code from the Zeppelin server?

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.

Zeppelin would redirect user to login page when user is unauthorized. Here I just assume redirect means unauthorized because I think this is the only place to have redirect response in zeppelin. But it is true that we should find a better way to detect unauthorized

* @return
* @throws Exception
*/
public NoteResult waitUntilNoteFinished(String noteId) throws Exception {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This function can lead to to an infinity loop. I would call waitUntilNoteFinished(String noteId, long timeoutInMills) with a high default timeout.

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.

There's another method waitUntilNoteFinished(String noteId, long timeoutInMills) which allow user to set timeout. The reason I didn't add a default large timeout is because of streaming scenario that may run forever, such as flink streaming job.

@zjffdu

Copy link
Copy Markdown
ContributorAuthor

First, I think this is a very big PR, and I hope that some others will also review this PR. Overall it seems to be really good. I see that the library unirest-java did the communication, this library seems useful.

I have seen that you catch all/most API Exceptions (example)
I think it is better to use an ExceptionMapper. If not, then you should remove the `throws' declaration.

Thanks for the review @Reamer , I have update the PR to use ExceptionMapper.

@zjffdu
zjffduforce-pushed the ZEPPELIN-4981 branch 2 times, most recently from 4741643 to bf5788dCompareSeptember 6, 2020 02:03
@zjffdu
zjffduforce-pushed the ZEPPELIN-4981 branch 2 times, most recently from 6ada563 to ed58f59CompareSeptember 8, 2020 04:52
@zjffdu

Copy link
Copy Markdown
ContributorAuthor

will merge it soon if no more comment

@asfgitasfgit closed this in f11e6f3Sep 9, 2020
asfgit pushed a commit that referenced this pull request Sep 9, 2020
### What is this PR for?
This is the initial PR fo introducing zeppelin client api. You can check this google doc for the overall design. https://docs.google.com/document/d/1bLLKKxleZlZpP9EFJlLLkJKwDBps-RNvzNwh3LFZWZ4/edit?usp=sharing
In this PR, I add 2 modules: zeppelin-client, zeppelin-client-examples.
You can take a look at the module zeppelin-client-examples to see how we can use zeppelin client api.
### What type of PR is it?
[ Feature ]
### Todos
* [ ] - Task
### What is the Jira issue?
* https://issues.apache.org/jira/browse/ZEPPELIN-4981
### How should this be tested?
* Manually tested and Unit test is added.
### 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#3887 from zjffdu/ZEPPELIN-4981 and squashes the following commits:
9b8ff42 [Jeff Zhang] update travis
8eddf3e [Jeff Zhang] use ExceptionMapper
bb05371 [Jeff Zhang] update
4205c1c [Jeff Zhang] code refactoring
53fe1c1 [Jeff Zhang] update examples
487cb8c [Jeff Zhang] minor update
d7d11f7 [Jeff Zhang] minor update
f5e1e2e [Jeff Zhang] add session reconnect
bc723e7 [Jeff Zhang] minor update
7fbd481 [Jeff Zhang] minor update
fe22986 [Jeff Zhang] add sessionId to ZSession
c770176 [Jeff Zhang] add session status api
1dbc414 [Jeff Zhang] move classes to websocket folder
0e43ce1 [Jeff Zhang] add more examples
39d230b [Jeff Zhang] fix ut
d4bbe95 [Jeff Zhang] add zeppelin client examples
5ca4995 [Jeff Zhang] update
5611b7b [Jeff Zhang] resolve gson dependency issue
1aa1d68 [Jeff Zhang] [ZEPPELIN-4981]. Zeppelin Client API (Zeppelin SDK)
(cherry picked from commit f11e6f3)
Signed-off-by: Jeff Zhang <zjffdu@apache.org>
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.

2 participants

@zjffdu@Reamer