-
Notifications
You must be signed in to change notification settings - Fork 2.8k
ZEPPELIN-1254 Make get and save Interpreter bindings calls via websocket #1247
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
| } | ||
|
|
||
| List<InterpreterSetting> availableSettings = notebook().getInterpreterFactory().get(); | ||
| for (InterpreterSetting setting : availableSettings) { |
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 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 ?
|
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? |
|
And please add test case if you are going further. |
|
@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; |
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 you'd better move this class into proper one. It's used in binding method only.
|
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? |
|
@jongyoul I'm planning to make those changes in this PR |
|
That sounds great |
|
@r-kamath if you are planning to add more changes in this PR, do you think it will make sense to:
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. |
| String noteID = (String) fromMessage.data.get("noteID"); | ||
| List<InterpreterSettingsList> settingList = | ||
| InterpreterBindingUtils.getInterpreterBindings(notebook(), noteID); | ||
| broadcastInterpreterBindings(noteID, settingList); |
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 broadcast can you just conn.send(serializeMessage)
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.
fixed 55d95ec
|
LGTM! |
| public InterpreterSettingListForNoteBind(String id, String name, | ||
| List<InterpreterInfo> interpreters, boolean selected) { | ||
| public InterpreterSettingsList(String id, String name, | ||
| List<InterpreterInfo> interpreters, boolean selected) { |
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.
Vertial align is not recommended. Could you please revert this into original one?
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.
will update
|
@r-kamath Don't you remove the rest api in this PR? If you do that, you don't have to make |
|
@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. |
|
@r-kamath But I thought you would removed rest api by your last comments. Do you think we should conserve both of them? |
|
@jongyoul Yes. we should keep both |
|
@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. |
|
@r-kamath Of course, I agree that it's good to support some apis with websocket, basically. |
|
But I think this is not proper scope of this PR. We need to open discussion on it. Your PR looks good to me. |
|
Merging this if no more discussion. |
### 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
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
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: