aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorSean Owen <sowen@cloudera.com>2016-07-08 20:17:50 -0700
committerReynold Xin <rxin@databricks.com>2016-07-08 20:17:50 -0700
commit6cef0183c0f0392dad78fec54635afdb9341b7f3 (patch)
tree5703af77cb4da8d735d05e75025181cbe573d536 /core
parentfd6e8f0e2269a2e7f24f79d5c2041816ea308c86 (diff)
downloadspark-6cef0183c0f0392dad78fec54635afdb9341b7f3.tar.gz
spark-6cef0183c0f0392dad78fec54635afdb9341b7f3.tar.bz2
spark-6cef0183c0f0392dad78fec54635afdb9341b7f3.zip
[SPARK-16376][WEBUI][SPARK WEB UI][APP-ID] HTTP ERROR 500 when using rest api "/applications//jobs" if array "stageIds" is empty
## What changes were proposed in this pull request? Avoid error finding max of empty Seq when stageIds is empty. It does fix the immediate problem; I don't know if it results in meaningful output, but not an error at least. ## How was this patch tested? Jenkins tests Author: Sean Owen <sowen@cloudera.com> Closes #14105 from srowen/SPARK-16376.
Diffstat (limited to 'core')
-rw-r--r--core/src/main/scala/org/apache/spark/status/api/v1/AllJobsResource.scala7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/src/main/scala/org/apache/spark/status/api/v1/AllJobsResource.scala b/core/src/main/scala/org/apache/spark/status/api/v1/AllJobsResource.scala
index 5783df5d82..b21d36d4a8 100644
--- a/core/src/main/scala/org/apache/spark/status/api/v1/AllJobsResource.scala
+++ b/core/src/main/scala/org/apache/spark/status/api/v1/AllJobsResource.scala
@@ -68,7 +68,12 @@ private[v1] object AllJobsResource {
listener: JobProgressListener,
includeStageDetails: Boolean): JobData = {
listener.synchronized {
- val lastStageInfo = listener.stageIdToInfo.get(job.stageIds.max)
+ val lastStageInfo =
+ if (job.stageIds.isEmpty) {
+ None
+ } else {
+ listener.stageIdToInfo.get(job.stageIds.max)
+ }
val lastStageData = lastStageInfo.flatMap { s =>
listener.stageIdToData.get((s.stageId, s.attemptId))
}