Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spark-submit how to set the user.name

want to set

mapreduce.job.user.name=myuser

Tried

spark-submit  --class com.MyClass
--conf mapreduce.job.user.name=myuser \ 
--conf spark.mapreduce.job.user.name=myuser \
--master yarn  \
--deploy-mode cluster \

Also tried

--conf user.name

in environment of Spark UI showing

user.name yarn
like image 496
ankursingh1000 Avatar asked Nov 09 '22 02:11

ankursingh1000


1 Answers

In Spark 3, set SPARK_USER as a system property.

https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/util/Utils.scala

  /**
   * Returns the current user name. This is the currently logged in user, unless that's been
   * overridden by the `SPARK_USER` environment variable.
   */
  def getCurrentUserName(): String = {
    Option(System.getenv("SPARK_USER"))
      .getOrElse(UserGroupInformation.getCurrentUser().getShortUserName())
  }
like image 143
Azeroth2b Avatar answered Nov 15 '22 12:11

Azeroth2b