Skip to content

Conversation

@r-kamath
Copy link
Member

What is this PR for?

This PR uses websocket to get and save interpreter bindings instead of rest api

What type of PR is it?

Improvement

Todos

  • - Task

What is the Jira issue?

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

How should this be tested?

Go to interpreter binding settings on notebook page and enable/disable interpreter or reorder and save. Simultaneously verify the network calls on browser's console.

Screenshots (if appropriate)

n/a

Questions:

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

}

List<InterpreterSetting> availableSettings = notebook().getInterpreterFactory().get();
for (InterpreterSetting setting : availableSettings) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I see duplicate effort in this, can you move this into a common function which both this and https://github.com/apache/zeppelin/blob/master/zeppelin-server/src/main/java/org/apache/zeppelin/rest/NotebookRestApi.java#L197-L211 can use ?

@jongyoul
Copy link
Member

This PR looks like copy and paste from NotebookRestAapi. If you think websocket is a better way to do it, why don't you removing rest api? I don't think it's good to duplicate only. What's the benefit to change rest api to websocket?

@jongyoul
Copy link
Member

And please add test case if you are going further.

@r-kamath
Copy link
Member Author

@jongyoul Yes. this is copied from rest api. We should probably keep both options and use websocket on zeppelin UI. IMHO we all communications on the ui should happen via websockets and avoid multiple calls to server. I'll be cleaning up the duplication in my next commit. @prabhjyotsingh also had similar comment on code duplication.

import org.apache.zeppelin.interpreter.InterpreterGroup;
import org.apache.zeppelin.interpreter.remote.RemoteAngularObjectRegistry;
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
import org.apache.zeppelin.rest.message.InterpreterSettingListForNoteBind;
Copy link
Member

@jongyoul jongyoul Jul 31, 2016

Choose a reason for hiding this comment

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

I think you'd better move this class into proper one. It's used in binding method only.

@jongyoul
Copy link
Member

Thanks for the explaining it, but I think you'd better handle those changes into single PR, which is more meaningful. How do you think of it?

@r-kamath
Copy link
Member Author

@jongyoul I'm planning to make those changes in this PR

@jongyoul
Copy link
Member

That sounds great

@bzz
Copy link
Member

bzz commented Aug 1, 2016

@r-kamath if you are planning to add more changes in this PR, do you think it will make sense to:

  • update TODO list in PR description with action items that you plan
  • add WIP prefix (work in progress) to the PR title, and remove it when everything is done

In my experience, this will help to communicate your intent with reviewers, save time for them and overall speed up the process of merging these changes.

@r-kamath r-kamath changed the title ZEPPELIN-1254 Make get and save Interpreter bindings calls via websocket [WIP] ZEPPELIN-1254 Make get and save Interpreter bindings calls via websocket Aug 2, 2016
@r-kamath r-kamath changed the title [WIP] ZEPPELIN-1254 Make get and save Interpreter bindings calls via websocket ZEPPELIN-1254 Make get and save Interpreter bindings calls via websocket Aug 2, 2016
String noteID = (String) fromMessage.data.get("noteID");
List<InterpreterSettingsList> settingList =
InterpreterBindingUtils.getInterpreterBindings(notebook(), noteID);
broadcastInterpreterBindings(noteID, settingList);
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of broadcast can you just conn.send(serializeMessage)

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed 55d95ec

@prabhjyotsingh
Copy link
Contributor

LGTM!

public InterpreterSettingListForNoteBind(String id, String name,
List<InterpreterInfo> interpreters, boolean selected) {
public InterpreterSettingsList(String id, String name,
List<InterpreterInfo> interpreters, boolean selected) {
Copy link
Member

Choose a reason for hiding this comment

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

Vertial align is not recommended. Could you please revert this into original one?

Copy link
Member Author

Choose a reason for hiding this comment

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

will update

@jongyoul
Copy link
Member

jongyoul commented Aug 3, 2016

@r-kamath Don't you remove the rest api in this PR? If you do that, you don't have to make getInterpreterBinding as a static because it's only used in notebook server. I thought you would removed interpreter binding rest api entry points and changed all of them into websocket.

@r-kamath
Copy link
Member Author

r-kamath commented Aug 3, 2016

@jongyoul I think we have users for rest api. The change here is to make ui work via websocket while keeping the reset apis intact.

@jongyoul
Copy link
Member

jongyoul commented Aug 3, 2016

@r-kamath But I thought you would removed rest api by your last comments. Do you think we should conserve both of them?

@r-kamath
Copy link
Member Author

r-kamath commented Aug 3, 2016

@jongyoul Yes. we should keep both

@jongyoul
Copy link
Member

jongyoul commented Aug 3, 2016

@r-kamath Actually, I don't know well how much efficient we change rest api to websocket because I'm not at front-end. I just wonder if we should keep two different entry point with exact same function.

@jongyoul
Copy link
Member

jongyoul commented Aug 3, 2016

@r-kamath Of course, I agree that it's good to support some apis with websocket, basically.

@jongyoul
Copy link
Member

jongyoul commented Aug 3, 2016

But I think this is not proper scope of this PR. We need to open discussion on it. Your PR looks good to me.

@prabhjyotsingh
Copy link
Contributor

Merging this if no more discussion.

@asfgit asfgit closed this in f71d09c Aug 8, 2016
PhilippGrulich pushed a commit to SWC-SENSE/zeppelin that referenced this pull request Aug 8, 2016
### What is this PR for?
This PR uses websocket to get and save interpreter bindings instead of rest api

### What type of PR is it?
Improvement

### Todos
* [ ] - Task

### What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-1254

### How should this be tested?
Go to interpreter binding settings on notebook page and enable/disable interpreter or reorder and save. Simultaneously verify the network calls on browser's console.

### Screenshots (if appropriate)
n/a
### Questions:
* Does the licenses files need update? n/a
* Is there breaking changes for older versions? n/a
* Does this needs documentation? n/a

Author: Renjith Kamath <renjith.kamath@gmail.com>

Closes apache#1247 from r-kamath/ZEPPELIN-1254 and squashes the following commits:

6ac1748 [Renjith Kamath] ZEPPELIN-1254 revert indentation
55d95ec [Renjith Kamath] ZEPPELIN-1254 review fix
ab0bced [Renjith Kamath] ZEPPELIN-1254  boradcast after updating the interpreter bindings
299bb51 [Renjith Kamath] ZEPPELIN-1254 review fix
97bfd7d [Renjith Kamath] ZEPPELIN-1254 Make get and save Interpreter bindings calls via websocket
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.

4 participants