@@ -89,10 +89,10 @@ private[history] class FsHistoryProvider(conf: SparkConf) extends ApplicationHis
8989
9090 override def getListing () = appList
9191
92- override def getAppInfo (appId : String ): ApplicationHistoryInfo = {
92+ override def getAppUI (appId : String ): SparkUI = {
9393 try {
9494 val appLogDir = fs.getFileStatus(new Path (logDir, appId))
95- loadAppInfo(appLogDir, true )
95+ loadAppInfo(appLogDir, true )._2
9696 } catch {
9797 case e : FileNotFoundException => null
9898 }
@@ -128,7 +128,7 @@ private[history] class FsHistoryProvider(conf: SparkConf) extends ApplicationHis
128128 val curr = currentApps.getOrElse(dir.getPath().getName(), null )
129129 if (curr == null || curr.lastUpdated < getModificationTime(dir)) {
130130 try {
131- newApps += loadAppInfo(dir, false )
131+ newApps += loadAppInfo(dir, false )._1
132132 } catch {
133133 case e : Exception => logError(s " Failed to load app info from directory $dir. " )
134134 }
@@ -152,10 +152,10 @@ private[history] class FsHistoryProvider(conf: SparkConf) extends ApplicationHis
152152 * clicks on a specific application.
153153 *
154154 * @param logDir Directory with application's log files.
155- * @param renderUI Whether to create the SparkUI for the application. If false, the "ui"
156- * attribute of the returned object will be null .
155+ * @param renderUI Whether to create the SparkUI for the application.
156+ * @return A 2-tuple `(app info, ui)`. `ui` will be null if `renderUI` is false .
157157 */
158- private def loadAppInfo (logDir : FileStatus , renderUI : Boolean ): ApplicationHistoryInfo = {
158+ private def loadAppInfo (logDir : FileStatus , renderUI : Boolean ) = {
159159 val elogInfo = EventLoggingListener .parseLoggingInfo(logDir.getPath(), fs)
160160 val path = logDir.getPath
161161 val appId = path.getName
@@ -173,14 +173,19 @@ private[history] class FsHistoryProvider(conf: SparkConf) extends ApplicationHis
173173 }
174174
175175 replayBus.replay()
176- ApplicationHistoryInfo (appId,
176+ val appInfo = ApplicationHistoryInfo (appId,
177177 appListener.appName,
178178 appListener.startTime,
179179 appListener.endTime,
180180 getModificationTime(logDir),
181- appListener.sparkUser,
182- if (renderUI) appListener.viewAcls else null ,
183- ui)
181+ appListener.sparkUser)
182+
183+ if (ui != null ) {
184+ val uiAclsEnabled = conf.getBoolean(" spark.history.ui.acls.enable" , false )
185+ ui.getSecurityManager.setUIAcls(uiAclsEnabled)
186+ ui.getSecurityManager.setViewAcls(appListener.sparkUser, appListener.viewAcls)
187+ }
188+ (appInfo, ui)
184189 }
185190
186191 /** Return when this directory was last modified. */
0 commit comments