Skip to content

Conversation

@prabhjyotsingh
Copy link
Contributor

@prabhjyotsingh prabhjyotsingh commented Nov 23, 2016

What is this PR for?

User impersonation of front end user does not work with SPARK_HOME set.

What type of PR is it?

[Bug Fix | Hot Fix]

Todos

  • - Fix log file permission issue

What is the Jira issue?

How should this be tested?

set SPARK_HOME zeppelin-env.sh and then try to run

%spark
System.getProperty("user.name")

Screenshots (if appropriate)

Questions:

  • Does the licenses files need update? N/A
  • Is there breaking changes for older versions? N/A
  • Does this needs documentation? Yes

@prabhjyotsingh
Copy link
Contributor Author

CC: @zjffdu can you help review this.

@zjffdu
Copy link
Contributor

zjffdu commented Nov 23, 2016

It still doesn't work for me.
This is the error I get, it seems permission issue because it use another user to run the interpreter process.

DEBUG [2016-11-23 16:13:06,100] ({Exec Stream Pumper} RemoteInterpreterManagedProcess.java[processLine]:189) - java.io.FileNotFoundException: /Users/jzhang/github/zeppelin/logs/zeppelin-interpreter-spark-jzhang-jzhangMBPr.local.log (Permission denied)

@prabhjyotsingh
Copy link
Contributor Author

can you try

chmod 777 /Users/jzhang/github/zeppelin/logs/zeppelin-interpreter-spark-jzhang-jzhangMBPr.local.log

@zjffdu
Copy link
Contributor

zjffdu commented Nov 23, 2016

I can do that, but it doesn't make sense to force user to do that.

@prabhjyotsingh
Copy link
Contributor Author

I assumed this log file should have group permission to log into this file. What do you recommend ?

@zjffdu
Copy link
Contributor

zjffdu commented Nov 23, 2016

I found another crtitical issue is that all the enviroment variables defined in zeppelin-env.sh (like HADOOP_CONF_DIR) won't be passed to the interpreter process because you use ssh. This will cause interpreter process fail to start.

@prabhjyotsingh
Copy link
Contributor Author

I think that should be fine;

...
    ZEPPELIN_INTP_CLASSPATH+=":${HADOOP_CONF_DIR}"
...
    CLASSPATH+=":${ZEPPELIN_INTP_CLASSPATH}"
...
   SPARK_SUBMIT_RUN=` echo ${SPARK_SUBMIT} --class ${ZEPPELIN_SERVER} --driver-class-path \"${ZEPPELIN_INTP_CLASSPATH_OVERRIDES}:${CLASSPATH}\" --driver-java-options \"${JAVA_INTP_OPTS}\" ${SPARK_SUBMIT_OPTIONS} ${SPARK_APP_JAR} ${PORT}`
...

https://github.com/apache/zeppelin/blob/master/bin/interpreter.sh#L171
https://github.com/apache/zeppelin/blob/master/bin/interpreter.sh#L186
https://github.com/apache/zeppelin/pull/1672/files#diff-8d3bd42a5de342ebad38e1d113d9f75cR189

@zjffdu
Copy link
Contributor

zjffdu commented Nov 23, 2016

Actually it doesn't work for spark interpreter if you try that. https://github.com/apache/zeppelin/blob/master/bin/interpreter.sh#L171 is for pig. And it is not safe if we add other enviroment variables that is not in classpath. Could we run zeppelin-env.sh after ssh ?

@prabhjyotsingh
Copy link
Contributor Author

I see your point, let me check that.

@prabhjyotsingh prabhjyotsingh changed the title ZEPPELIN-1701: User impersonation not work with SPARK_HOME set. [WIP] ZEPPELIN-1701: User impersonation not work with SPARK_HOME set. Nov 23, 2016
@prabhjyotsingh prabhjyotsingh changed the title [WIP] ZEPPELIN-1701: User impersonation not work with SPARK_HOME set. ZEPPELIN-1701: User impersonation not work with SPARK_HOME set. Nov 25, 2016
@prabhjyotsingh
Copy link
Contributor Author

prabhjyotsingh commented Nov 25, 2016

@zjffdu Here is what I've done

Can you review this and/or suggest more changes.

@felixcheung
Copy link
Member

as an aside, I'd update the JIRA/PR - it might not be obvious what "when SPARK_HOME is set" means. If external Spark is broken then I think it is a much much serious problem :)

@prabhjyotsingh
Copy link
Contributor Author

prabhjyotsingh commented Nov 28, 2016

This is ready for review, have checked this in few flavours of linux, and it was working as expected.

I'll add more documentation in a while.

@zjffdu
Copy link
Contributor

zjffdu commented Nov 28, 2016

@prabhjyotsingh It works now, but log file permission issue is still here which make the spark interpreter fail to run unless user manually set permission

@prabhjyotsingh
Copy link
Contributor Author

@zjffdu did you try it again, as this is working for me, or if you can let me know your environment I can try on the same.

@r-kamath
Copy link
Member

LGTM 👍

@Leemoonsoo
Copy link
Member

#1704 changes the filename processenduser.md to userimpersonation.md. Could you resolve conflict?

@prabhjyotsingh
Copy link
Contributor Author

@Leemoonsoo resolved conflict. Thank you for the quick fix.

CLASSPATH+=":${ZEPPELIN_INTP_CLASSPATH}"

if [[ ! -z "$ZEPPELIN_IMPERSONATE_USER" ]]; then
INTERPRETER_RUN_COMMAND=${ZEPPELIN_IMPERSONATE_RUN_CMD}" '"
Copy link
Member

Choose a reason for hiding this comment

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

this seem tricky so maybe I'm missing something, we are appending ' here?

Copy link
Member

Choose a reason for hiding this comment

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

and this follows immediately with source in L195, so it will be 'source - no space between ' and source?

Copy link
Contributor Author

@prabhjyotsingh prabhjyotsingh Nov 30, 2016

Choose a reason for hiding this comment

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

Yes the ' starts here (L193) and ends at L206. I can add a space between ' and source but since it was working I didn't do it.

@prabhjyotsingh
Copy link
Contributor Author

Merging this if no more discussion.

@asfgit asfgit closed this in d1fc86b Dec 2, 2016
@zjffdu
Copy link
Contributor

zjffdu commented Dec 2, 2016

@prabhjyotsingh I can not run pyspark interpreter. Can you try that in your enviroment ?

@zjffdu
Copy link
Contributor

zjffdu commented Dec 2, 2016

Please ignore it,I can ran it successfully now.

@prabhjyotsingh
Copy link
Contributor Author

Thank you for the verification.

@prabhjyotsingh prabhjyotsingh deleted the ZEPPELIN-1701 branch February 25, 2018 03:47
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.

5 participants