Repository: spark Updated Branches: refs/heads/master 0a4b7e4f8 -> 581565dd8
[SPARK-21124][UI] Show correct application user in UI. The jobs page currently shows the application user, but it assumes the OS user is the same as the user running the application, which may not be true in all scenarios (e.g., kerberos). While it might be useful to show both in the UI, this change just chooses the application user over the OS user, since the latter can be found in the environment page if needed. Tested in live application and in history server. Author: Marcelo Vanzin <[email protected]> Closes #18331 from vanzin/SPARK-21124. Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/581565dd Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/581565dd Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/581565dd Branch: refs/heads/master Commit: 581565dd871ca51507603d19b2d4203993c2636d Parents: 0a4b7e4 Author: Marcelo Vanzin <[email protected]> Authored: Mon Jun 19 14:41:58 2017 -0700 Committer: Marcelo Vanzin <[email protected]> Committed: Mon Jun 19 14:41:58 2017 -0700 ---------------------------------------------------------------------- core/src/main/scala/org/apache/spark/ui/SparkUI.scala | 4 +++- .../src/main/scala/org/apache/spark/ui/env/EnvironmentTab.scala | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/581565dd/core/src/main/scala/org/apache/spark/ui/SparkUI.scala ---------------------------------------------------------------------- diff --git a/core/src/main/scala/org/apache/spark/ui/SparkUI.scala b/core/src/main/scala/org/apache/spark/ui/SparkUI.scala index f271c56..589f811 100644 --- a/core/src/main/scala/org/apache/spark/ui/SparkUI.scala +++ b/core/src/main/scala/org/apache/spark/ui/SparkUI.scala @@ -86,7 +86,9 @@ private[spark] class SparkUI private ( initialize() def getSparkUser: String = { - environmentListener.systemProperties.toMap.getOrElse("user.name", "<unknown>") + environmentListener.sparkUser + .orElse(environmentListener.systemProperties.toMap.get("user.name")) + .getOrElse("<unknown>") } def getAppName: String = appName http://git-wip-us.apache.org/repos/asf/spark/blob/581565dd/core/src/main/scala/org/apache/spark/ui/env/EnvironmentTab.scala ---------------------------------------------------------------------- diff --git a/core/src/main/scala/org/apache/spark/ui/env/EnvironmentTab.scala b/core/src/main/scala/org/apache/spark/ui/env/EnvironmentTab.scala index 8c18464..61b12aa 100644 --- a/core/src/main/scala/org/apache/spark/ui/env/EnvironmentTab.scala +++ b/core/src/main/scala/org/apache/spark/ui/env/EnvironmentTab.scala @@ -34,11 +34,16 @@ private[ui] class EnvironmentTab(parent: SparkUI) extends SparkUITab(parent, "en @DeveloperApi @deprecated("This class will be removed in a future release.", "2.2.0") class EnvironmentListener extends SparkListener { + var sparkUser: Option[String] = None var jvmInformation = Seq[(String, String)]() var sparkProperties = Seq[(String, String)]() var systemProperties = Seq[(String, String)]() var classpathEntries = Seq[(String, String)]() + override def onApplicationStart(event: SparkListenerApplicationStart): Unit = { + sparkUser = Some(event.sparkUser) + } + override def onEnvironmentUpdate(environmentUpdate: SparkListenerEnvironmentUpdate) { synchronized { val environmentDetails = environmentUpdate.environmentDetails --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
