Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Not A Problem
-
2.2.0
-
None
-
None
Description
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
env("SPARK_USER") = UserGroupInformation.getCurrentUser().getShortUserName()
in the am container context
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() }) }