You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Saisai Shao (JIRA)" <ji...@apache.org> on 2017/09/11 06:46:00 UTC

[jira] [Closed] (SPARK-21906) No need to runAsSparkUser to switch UserGroupInformation in YARN mode

     [ https://issues.apache.org/jira/browse/SPARK-21906?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Saisai Shao closed SPARK-21906.
-------------------------------
    Resolution: Not A Problem

> 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