Skip to content

Commit 548c753

Browse files
committed
History Server: updated order for multiple attempts(descending start time works everytime)
1 parent 83306a8 commit 548c753

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

core/src/main/scala/org/apache/spark/deploy/history/FsHistoryProvider.scala

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,8 @@ private[history] class FsHistoryProvider(conf: SparkConf, clock: Clock)
413413

414414
/**
415415
* Comparison function that defines the sort order for application attempts within the same
416-
* application. Order is: completed attempts before running attempts, if both completed
417-
* or both running attempts sorted by descending start time.
416+
* application. Order is: later attempts before earlier attempts.
417+
* The most recent attempt state matches with current state of the app.
418418
*
419419
* Normally applications should have a single running attempt; but failure to call sc.stop()
420420
* may cause multiple running attempts to show up.
@@ -424,11 +424,7 @@ private[history] class FsHistoryProvider(conf: SparkConf, clock: Clock)
424424
private def compareAttemptInfo(
425425
a1: FsApplicationAttemptInfo,
426426
a2: FsApplicationAttemptInfo): Boolean = {
427-
if (a1.completed == a2.completed) {
428-
a1.startTime >= a2.startTime
429-
} else {
430-
a1.completed
431-
}
427+
a1.startTime >= a2.startTime
432428
}
433429

434430
/**

0 commit comments

Comments
 (0)