Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/1218#discussion_r15482289
  
    --- Diff: 
core/src/main/scala/org/apache/spark/deploy/history/FsHistoryProvider.scala ---
    @@ -91,12 +96,30 @@ private[history] class FsHistoryProvider(conf: 
SparkConf) extends ApplicationHis
         logCheckingThread.start()
       }
     
    -  override def getListing() = appList
    +  override def getListing() = appList.values
     
       override def getAppUI(appId: String): SparkUI = {
         try {
    -      val appLogDir = fs.getFileStatus(new Path(logDir, appId))
    -      loadAppInfo(appLogDir, true)._2
    +      appList.get(appId).map(info => {
    +        val (replayBus, appListener) = createReplayBus(fs.getFileStatus(
    +          new Path(logDir, info.logDir)))
    +        val ui = {
    +          val conf = this.conf.clone()
    +          val appSecManager = new SecurityManager(conf)
    +          new SparkUI(conf, appSecManager, replayBus, appId, "/history/" + 
appId)
    +          // Do not call ui.bind() to avoid creating a new server for each 
application
    +        }
    +
    +        replayBus.replay()
    +
    +        // Note that this does not have any effect due to SPARK-2169.
    +        ui.setAppName(s"${appListener.appName} ($appId)")
    +
    +        val uiAclsEnabled = 
conf.getBoolean("spark.history.ui.acls.enable", false)
    +        ui.getSecurityManager.setUIAcls(uiAclsEnabled)
    +        ui.getSecurityManager.setViewAcls(appListener.sparkUser, 
appListener.viewAcls)
    +        ui
    +      }).getOrElse(null)
    --- End diff --
    
    If there's a chance you might return a null here, it's safer if this method 
returns an Option instead. Right now this is another potential source of NPE if 
the caller doesn't make the right assumptions.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to