Skip to content

Commit 18bde1c

Browse files
committed
address comment
1 parent d0dbded commit 18bde1c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

core/src/main/scala/org/apache/spark/status/AppStatusStore.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ private[spark] class AppStatusStore(
136136
store.read(classOf[StageDataWrapper], Array(stageId, stageAttemptId)).locality
137137
}
138138

139+
private def isLiveUI: Boolean = listener.isDefined
140+
139141
/**
140142
* Calculates a summary of the task metrics for the given stage attempt, returning the
141143
* requested quantiles for the recorded metrics.
@@ -156,7 +158,7 @@ private[spark] class AppStatusStore(
156158
// cheaper for disk stores (avoids deserialization).
157159
val count = {
158160
Utils.tryWithResource(
159-
if (store.isInstanceOf[ElementTrackingStore]) {
161+
if (isLiveUI) {
160162
// For Live UI, we should count the tasks with status "SUCCESS" only.
161163
store.view(classOf[TaskDataWrapper])
162164
.parent(stageKey)
@@ -246,7 +248,7 @@ private[spark] class AppStatusStore(
246248
// and failed tasks differently (would be tricky). Also would require changing the disk store
247249
// version (to invalidate old stores).
248250
def scanTasks(index: String)(fn: TaskDataWrapper => Long): IndexedSeq[Double] = {
249-
if (store.isInstanceOf[ElementTrackingStore]) {
251+
if (isLiveUI) {
250252
val quantileTasks = store.view(classOf[TaskDataWrapper])
251253
.parent(stageKey)
252254
.index(index)

0 commit comments

Comments
 (0)