spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Apache Spark (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SPARK-21906) No need to runAsSparkUser to switch UserGroupInformation in YARN mode
Date Mon, 04 Sep 2017 09:05:00 GMT

    [ https://issues.apache.org/jira/browse/SPARK-21906?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16152295#comment-16152295
] 

Apache Spark commented on SPARK-21906:
--------------------------------------

User 'yaooqinn' has created a pull request for this issue:
https://github.com/apache/spark/pull/19121

> No need to runAsSparkUser to switch UserGroupInformation in YARN mode
> ---------------------------------------------------------------------
>
>                 Key: SPARK-21906
>                 URL: https://issues.apache.org/jira/browse/SPARK-21906
>             Project: Spark
>          Issue Type: Improvement
>          Components: Spark Core, YARN
>    Affects Versions: 2.2.0
>            Reporter: Kent Yao
>
> 1、The Yarn application‘s ugi is determined by the ugi launching it
> 2、 runAsSparkUser is used to switch a ugi as same as itself, because we have already
set {code:java} env("SPARK_USER") = UserGroupInformation.getCurrentUser().getShortUserName()
{code} in the am container context
> {code:java}
>  def runAsSparkUser(func: () => Unit) {
>     val user = Utils.getCurrentUserName()  // get the user itself
>     logDebug("running as user: " + user)
>     val ugi = UserGroupInformation.createRemoteUser(user) // create a new ugi use itself
>     transferCredentials(UserGroupInformation.getCurrentUser(), ugi) // transfer its own
credentials 
>     ugi.doAs(new PrivilegedExceptionAction[Unit] { // doAs as itseft
>       def run: Unit = func()
>     })
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org


Mime
View raw message