-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[ZEPPELIN-1320] Run zeppelin interpreter process as web front end user #1322
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
Closed
Closed
Changes from 2 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
6aafac4
user should have option to run these interpreters as different user.
prabhjyotsingh 0ab2fe0
add userName as parameter in createOrGetIntepreter
prabhjyotsingh 2758b7f
passing user and isUserImpersonate to RemoteInterpreterManagedProcess
prabhjyotsingh 862f937
Merge remote-tracking branch 'origin/master' into ZEPPELIN-1320
prabhjyotsingh a2fea0c
fix indentation
prabhjyotsingh 590032e
change nulls to "anonymous" in tests
prabhjyotsingh 787a108
fix CI
prabhjyotsingh 965c8a7
fix CI, null check before deleting paragraph
prabhjyotsingh 8c324cd
CI fix: build stall for InterpreterRestApiTest
prabhjyotsingh e0a0ccf
Merge remote-tracking branch 'origin/master' into ZEPPELIN-1320
prabhjyotsingh 55ccce3
revert shiro.ini and InterpreterGroup
prabhjyotsingh cc6c12e
use fromMessage.principal instead of anonymous
prabhjyotsingh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,50 +17,13 @@ | |
|
|
||
| package org.apache.zeppelin.interpreter; | ||
|
|
||
| import java.io.BufferedReader; | ||
| import java.io.File; | ||
| import java.io.FileInputStream; | ||
| import java.io.FileNotFoundException; | ||
| import java.io.FileOutputStream; | ||
| import java.io.IOException; | ||
| import java.io.InputStream; | ||
| import java.io.InputStreamReader; | ||
| import java.io.OutputStreamWriter; | ||
| import java.lang.reflect.Constructor; | ||
| import java.lang.reflect.InvocationTargetException; | ||
| import java.lang.reflect.Type; | ||
| import java.net.MalformedURLException; | ||
| import java.net.URL; | ||
| import java.net.URLClassLoader; | ||
| import java.nio.file.DirectoryStream; | ||
| import java.nio.file.Files; | ||
| import java.nio.file.Path; | ||
| import java.nio.file.Paths; | ||
| import java.util.ArrayList; | ||
| import java.util.Collection; | ||
| import java.util.Collections; | ||
| import java.util.Comparator; | ||
| import java.util.HashMap; | ||
| import java.util.Iterator; | ||
| import java.util.LinkedList; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.Properties; | ||
| import java.util.Set; | ||
|
|
||
| import com.google.common.base.Preconditions; | ||
| import com.google.gson.Gson; | ||
| import com.google.gson.GsonBuilder; | ||
| import com.google.gson.reflect.TypeToken; | ||
| import org.apache.commons.io.FileUtils; | ||
| import org.apache.commons.lang.ArrayUtils; | ||
| import org.apache.commons.lang.NullArgumentException; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
| import org.sonatype.aether.RepositoryException; | ||
| import org.sonatype.aether.repository.Authentication; | ||
| import org.sonatype.aether.repository.RemoteRepository; | ||
|
|
||
| import org.apache.zeppelin.conf.ZeppelinConfiguration; | ||
| import org.apache.zeppelin.conf.ZeppelinConfiguration.ConfVars; | ||
| import org.apache.zeppelin.dep.Dependency; | ||
|
|
@@ -76,6 +39,24 @@ | |
| import org.apache.zeppelin.interpreter.remote.RemoteInterpreterProcessListener; | ||
| import org.apache.zeppelin.scheduler.Job; | ||
| import org.apache.zeppelin.scheduler.Job.Status; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
| import org.sonatype.aether.RepositoryException; | ||
| import org.sonatype.aether.repository.Authentication; | ||
| import org.sonatype.aether.repository.RemoteRepository; | ||
|
|
||
| import java.io.*; | ||
| import java.lang.reflect.Constructor; | ||
| import java.lang.reflect.InvocationTargetException; | ||
| import java.lang.reflect.Type; | ||
| import java.net.MalformedURLException; | ||
| import java.net.URL; | ||
| import java.net.URLClassLoader; | ||
| import java.nio.file.DirectoryStream; | ||
| import java.nio.file.Files; | ||
| import java.nio.file.Path; | ||
| import java.nio.file.Paths; | ||
| import java.util.*; | ||
|
|
||
| /** | ||
| * Manage interpreters. | ||
|
|
@@ -1094,14 +1075,15 @@ private String getInterpreterClassFromInterpreterSetting(InterpreterSetting sett | |
| return null; | ||
| } | ||
|
|
||
| private Interpreter getInterpreter(String noteId, InterpreterSetting setting, String name) { | ||
| private Interpreter getInterpreter(String noteId, InterpreterSetting setting, String name, | ||
| String userName) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably a nitpick, but horizontal alignment is controversial idea and generally is discouraged by the styleguide as it creates a "blast radius" of re-formatting in case of future changes i.e renaming a function. |
||
| Preconditions.checkNotNull(noteId, "noteId should be not null"); | ||
| Preconditions.checkNotNull(setting, "setting should be not null"); | ||
| Preconditions.checkNotNull(name, "name should be not null"); | ||
|
|
||
| String className; | ||
| if (null != (className = getInterpreterClassFromInterpreterSetting(setting, name))) { | ||
| List<Interpreter> interpreterGroup = createOrGetInterpreterList(noteId, setting); | ||
| List<Interpreter> interpreterGroup = createOrGetInterpreterList(noteId + userName, setting); | ||
| for (Interpreter interpreter : interpreterGroup) { | ||
| if (className.equals(interpreter.getClassName())) { | ||
| return interpreter; | ||
|
|
@@ -1111,7 +1093,7 @@ private Interpreter getInterpreter(String noteId, InterpreterSetting setting, St | |
| return null; | ||
| } | ||
|
|
||
| public Interpreter getInterpreter(String noteId, String replName) { | ||
| public Interpreter getInterpreter(String noteId, String replName, String userName) { | ||
| List<InterpreterSetting> settings = getInterpreterSettings(noteId); | ||
| InterpreterSetting setting; | ||
| Interpreter interpreter; | ||
|
|
@@ -1124,7 +1106,7 @@ public Interpreter getInterpreter(String noteId, String replName) { | |
| // get default settings (first available) | ||
| // TODO(jl): Fix it in case of returning null | ||
| InterpreterSetting defaultSettings = getDefaultInterpreterSetting(settings); | ||
| return createOrGetInterpreterList(noteId, defaultSettings).get(0); | ||
| return createOrGetInterpreterList(noteId + userName, defaultSettings).get(0); | ||
| } | ||
|
|
||
| String[] replNameSplit = replName.split("\\."); | ||
|
|
@@ -1137,7 +1119,7 @@ public Interpreter getInterpreter(String noteId, String replName) { | |
| setting = getInterpreterSettingByGroup(settings, group); | ||
|
|
||
| if (null != setting) { | ||
| interpreter = getInterpreter(noteId, setting, name); | ||
| interpreter = getInterpreter(noteId, setting, name, userName); | ||
|
|
||
| if (null != interpreter) { | ||
| return interpreter; | ||
|
|
@@ -1152,7 +1134,7 @@ public Interpreter getInterpreter(String noteId, String replName) { | |
| // TODO(jl): Handle with noteId to support defaultInterpreter per note. | ||
| setting = getDefaultInterpreterSetting(settings); | ||
|
|
||
| interpreter = getInterpreter(noteId, setting, replName); | ||
| interpreter = getInterpreter(noteId, setting, replName, userName); | ||
|
|
||
| if (null != interpreter) { | ||
| return interpreter; | ||
|
|
@@ -1163,7 +1145,7 @@ public Interpreter getInterpreter(String noteId, String replName) { | |
| setting = getInterpreterSettingByGroup(settings, replName); | ||
|
|
||
| if (null != setting) { | ||
| List<Interpreter> interpreters = createOrGetInterpreterList(noteId, setting); | ||
| List<Interpreter> interpreters = createOrGetInterpreterList(noteId + userName, setting); | ||
| if (null != interpreters) { | ||
| return interpreters.get(0); | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This requires the login user must exist in the os account and be able to ssh to localhost. I am not sure whether this is a good way, but just feel the approach is a little strange compared to the impersonation implementation in hadoop.
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.
@zjffdu yes, I agree, its not as implementation in hadoop, would you recommend something else ?