-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[ZEPPELIN-1012] Support Interpreter Aliases #1145
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
|
I have tested this branch and i've got some feedbacks Interpreter-setting name and alias Interpreter selection mechanism. I strongly recommend keep compatibility of previous interpreter selection mechanism, because it changes major user experience of Zeppelin. My suggestion is,
while matching rule is
Import and change interpreter binding It can be a future work, but i'd like to at least have an direction how we want to handle user experience change expected this PR brings. Before After |
|
@Leemoonsoo Thanks for the review, and because this is the first working draft and I've changed a lot, some incompatibility and bug may exists. I'll fix them. Concerning name and alias, that's also what i ask for. Keeping both of them would be redundant. And I'll check the selection mechanism. It may occurs because I've changed getInterpreter code for not using |
Extracted InterpreterInfo from InterpreterSetting
Changed menu for creating new InterpreterSetting
|
@Leemoonsoo Merged name and aliases, and enabled working with 0.6.0's conf/interpreter.json. Concerning matching interpreters, I've test it with 0.6.0 binary. But there're something different from what you mentioned. If you choose |
Fixed the type of variables Adjusted diamond operator
|
Merging if there's no more discussion |
| private transient String path; | ||
|
|
||
| @Deprecated | ||
| private String group; |
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.
Is there any special reason deprecate group and create refName instead?
In my understanding, value in refName is always exactly the same to value held by group previously.
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.
There're two reason. The most important point is mapping interpreterSettingRef and interpreterSetting. If we keep group as the name of interpreter, InterpreterSetting.group points InterpreterSetting.name. I think it makes more difficult to understand mapping. Currently, InterpreterSetting.refName points InterpreterSettingRef.name. I thought it would be better. Second, in more minor reason, This is a bit confusion from InterpreterGroup. InterpreterSetting.group is not related interpreterGroup but because those two terms includes group in their name, it looks related. It, however, is minor issue.
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.
And the reason why I deprecated instead of removing it is backward compatibility.
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.
If field name is used internally only, refName might help understand relation between InterpreterSetting.name and InterpreterSettingRef.name.
However, field name in InterpreterSetting change format of conf/interpreter.json and interpreter setting creation REST api.
So i'm not sure it's good idea to change file format and REST api to improve readability of internal code. Users might already have some external tools and codes that interact with conf/interpreter.json and interpreter setting creation REST api.
I think we can just add comment in the source code to clarify how InterpreterSettingRef and InterpreterSetting is mapped, without field name change.
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.
Ok, I've got it. Actually variable names are not important and I agree that it's also good to keep that name. I'll revert those changes.
|
Regarding Thought it was coming from this PR but found that The difference is, previously, ZeppelinServer (InterpreterFactory, NoteReplLoader) decide which interpreter to load and print |
|
Another behavior change i found from this PR is, When no interpreter is binded to a notebook, (e.g. incase of conf/interpreter.json is removed) Previously, default set of selections were, a interpreter setting from each interpreter groups. This PR suggest the first interpreter setting only. |
|
|
||
| intpSetting.setInterpreterGroupFactory(this); | ||
| interpreterSettings.put(intpSetting.id(), intpSetting); | ||
| saveToFile(); |
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.
Is there any reason not saving it?
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've replace the function of add to add interpreterSettingRef and add new method called createNewSetting. Thus this method is called when InterpreterFactory.init() only and init method run saveToFile() at the end of method. Thus It would be redundant. But, I've missed saveToFile() at the end of createNewSetting. I'll add it into createNewSetting
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've added saveToFile() at the end of createNewSetting, pushed it.
|
@Leemoonsoo I've check the default binding issues and I will fix it. |
Removed meaningless super constructor
|
@Leemoonsoo Concerning |
|
@Leemoonsoo I've reverted |
|
@jongyoul Thanks! I have tested and reviewed the code. and looks good except one behavior. Let's say there're two interpreter settings. previously '%spark' select So after this PR, in this specific case, notebook will not be run before user change interpreter selection text in every paragraphs. How do you think about supporting previous interpreter selection mechanism, too? Will there be any side effect to support previous interpreter selection mechanism? Or do you think it's better support new selection mechanism only? |
|
@Leemoonsoo I agree that this PR lower user experience in your case. It's better to support that feature for backward compatibility. BTW, I also think this makes users confused because user has no interpreter setting like |
|
@Leemoonsoo Thanks for detail review!! |
### What is this PR for? Supporting aliases for same interpreter group and enabling running two interpreters in same group. ### What type of PR is it? [Feature] ### Todos * [x] - Add InterpreterSettingRef * [x] - Add aliases feature ### What is the Jira issue? * https://issues.apache.org/jira/browse/ZEPPELIN-1012 ### How should this be tested? 1. Create spark2 interpreter in a interpreter tab 1. Add that interpreter in a notebook 1. run `%spark` and `%spark2` ### 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: Jongyoul Lee <[email protected]> Closes apache#1145 from jongyoul/ZEPPELIN-1012 and squashes the following commits: 4d38462 [Jongyoul Lee] Reverted modifier of CronJob back to public 2fab2f2 [Jongyoul Lee] Reverted default constructor 7f9f72d [Jongyoul Lee] Fixed the style 4dd8f6e [Jongyoul Lee] Reverted style into original to avoid checkstyle 5eff48f [Jongyoul Lee] Reverted style into original to avoid checkstyle 5e50864 [Jongyoul Lee] Reverted refName to group fac0b86 [Jongyoul Lee] Reformatted files related to this PR without test classes 5bb15a0 [Jongyoul Lee] Removed some console.log added for debugging 334634a [Jongyoul Lee] Fixed the description of parameter of add method ca20889 [Jongyoul Lee] Changed setting.group to setting.name Removed meaningless super constructor dde2232 [Jongyoul Lee] Added catching IOE from caller of createNewSetting cb7dde5 [Jongyoul Lee] Fixed wrong test to save to file after Zeppelin calls createNewSetting d59029b [Jongyoul Lee] Removed unused code Fixed the type of variables Adjusted diamond operator 9b05ca2 [Jongyoul Lee] Fixed some style e585791 [Jongyoul Lee] Fixed some style 634cc21 [Jongyoul Lee] Fixed usage of getGroup c100f76 [Jongyoul Lee] Removed deprecated method 240c8af [Jongyoul Lee] Removed debugging message 4ff493b [Jongyoul Lee] Fixed test case d5a4c44 [Jongyoul Lee] Refactored InterpreterSetting Changed menu for creating new InterpreterSetting 16b56c3 [Jongyoul Lee] Fixed broken tests for InterpreterRestApiTest fccdd9b [Jongyoul Lee] Fixed the style 5159a84 [Jongyoul Lee] Added feature for Interpreter aliases Extracted InterpreterInfo from InterpreterSetting c4b016e [Jongyoul Lee] Refactored getInterpreter method not to use RegisteredInterpreter
### What is this PR for? This is complete work of #1148. Comments and tasks on #1148 has been handled in this PR. - Add syntax language information in `interpreter-setting.json` - When user type `%replName` in paragraph, back-end check if the interpreter name with `replName` exists, and return language information to front-end if it does - If user doesn't specify `%replName`, default interpreter's language will be used - Using alias name for paragraph syntax highlight ### What type of PR is it? [Bug Fix | Improvement] ### What is the Jira issue? [ZEPPELIN-1026](https://issues.apache.org/jira/browse/ZEPPELIN-1026) ### How should this be tested? 1. Create new note and make markdown interpreter to be default. 2. See if markdown syntax is applied. ### Screenshots (if appropriate) #### Case 1. When the default interpreter set to python interpreter. **Before** Has `scala` as syntax highlight language when %python is not set. <img width="665" alt="screen shot 2016-07-07 at 10 46 20 pm" src="https://cloud.githubusercontent.com/assets/8503346/16655312/af67a302-4494-11e6-949e-793ad0515d7a.png"> **After** Has `python` as syntax highlight language even when %python is not set. <img width="666" alt="screen shot 2016-07-07 at 10 44 39 pm" src="https://cloud.githubusercontent.com/assets/8503346/16655248/769d8ba4-4494-11e6-9b3c-dc5e026e9c53.png"> #### Case 2. When use alias name as repl name. **Before** <img width="742" alt="screen shot 2016-09-08 at 4 22 39 pm" src="https://cloud.githubusercontent.com/assets/8503346/18353471/620c5ede-75e2-11e6-9d01-0726bc900dc0.png"> **After** <img width="741" alt="screen shot 2016-09-08 at 4 34 57 pm" src="https://cloud.githubusercontent.com/assets/8503346/18353487/6cdaa406-75e2-11e6-831a-08e0fa3a85d8.png"> ### Further possible improvements There are still several cases that Zeppelin doesn't handle syntax highlight well. These can be handled with another jira ticket/PR. 1. When default bound interpreter changes, syntax highlight is not changed accordingly 2. When copy/paste code, syntax highlight won't be applied properly since Zeppelin only checks changes when cursor is in first line. ### Questions: * Does the licenses files need update? no * Is there breaking changes for older versions? no * Does this needs documentation? yes(for creating new interpreter) Author: Mina Lee <[email protected]> Closes #1415 from minahlee/ZEPPELIN-1026 and squashes the following commits: c66fb0e [Mina Lee] Move getEditorSetting to InterpreterFactory class 2d56222 [Mina Lee] Add description about default syntax highlight in doc 08ccad9 [Mina Lee] Fix test 0874522 [Mina Lee] Change condition for triggering 'getAndSetEditorSetting' to reduce front-end <-> back-end communication 9e4f2e9 [Mina Lee] Change the way to read interpreter language from interpreter-setting.json after #1145 75543b3 [Mina Lee] Add test 565d9d0 [Mina Lee] [DOC] Setting syntax highlight when writing new interpreter 20132ca [Mina Lee] Get paragraph editor mode from backend 52f4207 [Mina Lee] Align comments for readability 26cbbb8 [Mina Lee] Add editor field
### What is this PR for? This is complete work of apache#1148. Comments and tasks on apache#1148 has been handled in this PR. - Add syntax language information in `interpreter-setting.json` - When user type `%replName` in paragraph, back-end check if the interpreter name with `replName` exists, and return language information to front-end if it does - If user doesn't specify `%replName`, default interpreter's language will be used - Using alias name for paragraph syntax highlight ### What type of PR is it? [Bug Fix | Improvement] ### What is the Jira issue? [ZEPPELIN-1026](https://issues.apache.org/jira/browse/ZEPPELIN-1026) ### How should this be tested? 1. Create new note and make markdown interpreter to be default. 2. See if markdown syntax is applied. ### Screenshots (if appropriate) #### Case 1. When the default interpreter set to python interpreter. **Before** Has `scala` as syntax highlight language when %python is not set. <img width="665" alt="screen shot 2016-07-07 at 10 46 20 pm" src="https://cloud.githubusercontent.com/assets/8503346/16655312/af67a302-4494-11e6-949e-793ad0515d7a.png"> **After** Has `python` as syntax highlight language even when %python is not set. <img width="666" alt="screen shot 2016-07-07 at 10 44 39 pm" src="https://cloud.githubusercontent.com/assets/8503346/16655248/769d8ba4-4494-11e6-9b3c-dc5e026e9c53.png"> #### Case 2. When use alias name as repl name. **Before** <img width="742" alt="screen shot 2016-09-08 at 4 22 39 pm" src="https://cloud.githubusercontent.com/assets/8503346/18353471/620c5ede-75e2-11e6-9d01-0726bc900dc0.png"> **After** <img width="741" alt="screen shot 2016-09-08 at 4 34 57 pm" src="https://cloud.githubusercontent.com/assets/8503346/18353487/6cdaa406-75e2-11e6-831a-08e0fa3a85d8.png"> ### Further possible improvements There are still several cases that Zeppelin doesn't handle syntax highlight well. These can be handled with another jira ticket/PR. 1. When default bound interpreter changes, syntax highlight is not changed accordingly 2. When copy/paste code, syntax highlight won't be applied properly since Zeppelin only checks changes when cursor is in first line. ### Questions: * Does the licenses files need update? no * Is there breaking changes for older versions? no * Does this needs documentation? yes(for creating new interpreter) Author: Mina Lee <[email protected]> Closes apache#1415 from minahlee/ZEPPELIN-1026 and squashes the following commits: c66fb0e [Mina Lee] Move getEditorSetting to InterpreterFactory class 2d56222 [Mina Lee] Add description about default syntax highlight in doc 08ccad9 [Mina Lee] Fix test 0874522 [Mina Lee] Change condition for triggering 'getAndSetEditorSetting' to reduce front-end <-> back-end communication 9e4f2e9 [Mina Lee] Change the way to read interpreter language from interpreter-setting.json after apache#1145 75543b3 [Mina Lee] Add test 565d9d0 [Mina Lee] [DOC] Setting syntax highlight when writing new interpreter 20132ca [Mina Lee] Get paragraph editor mode from backend 52f4207 [Mina Lee] Align comments for readability 26cbbb8 [Mina Lee] Add editor field



What is this PR for?
Supporting aliases for same interpreter group and enabling running two interpreters in same group.
What type of PR is it?
[Feature]
Todos
What is the Jira issue?
How should this be tested?
%sparkand%spark2Screenshots (if appropriate)
Questions: