Skip to content

Commit

Permalink
History Server: updated order for multiple attempts(descending start …
Browse files Browse the repository at this point in the history
…time)
  • Loading branch information
rekhajoshm committed Jul 12, 2015
1 parent b0fc922 commit 83306a8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,8 @@ private[history] class FsHistoryProvider(conf: SparkConf, clock: Clock)

/**
* Comparison function that defines the sort order for application attempts within the same
* application. Order is: completed attempts before running attempts, running attempts sorted
* by ascending start time,completed attempts sorted by ascending end time.
* application. Order is: completed attempts before running attempts, if both completed
* or both running attempts sorted by descending start time.
*
* Normally applications should have a single running attempt; but failure to call sc.stop()
* may cause multiple running attempts to show up.
Expand All @@ -425,7 +425,7 @@ private[history] class FsHistoryProvider(conf: SparkConf, clock: Clock)
a1: FsApplicationAttemptInfo,
a2: FsApplicationAttemptInfo): Boolean = {
if (a1.completed == a2.completed) {
if (a1.completed) a1.endTime <= a2.endTime else a1.startTime <= a2.startTime
a1.startTime >= a2.startTime
} else {
a1.completed
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ class FsHistoryProviderSuite extends SparkFunSuite with BeforeAndAfter with Matc
updateAndCheck(provider) { list =>
list.size should be (1)
list.head.attempts.size should be (2)
list.head.attempts.head.attemptId should be (Some("attempt1"))
list.head.attempts.head.attemptId should be (Some("attempt2"))
}

val attempt3 = newLogFile("app1", Some("attempt3"), inProgress = false)
Expand All @@ -289,7 +289,7 @@ class FsHistoryProviderSuite extends SparkFunSuite with BeforeAndAfter with Matc
}

val app2Attempt1 = newLogFile("app2", Some("attempt1"), inProgress = false)
writeFile(attempt2, true, None,
writeFile(attempt1, true, None,
SparkListenerApplicationStart("app2", Some("app2"), 5L, "test", Some("attempt1")),
SparkListenerApplicationEnd(6L)
)
Expand Down

0 comments on commit 83306a8

Please sign in to comment.