diff --git a/core/src/main/scala/org/apache/spark/status/api/v1/api.scala b/core/src/main/scala/org/apache/spark/status/api/v1/api.scala index a45c57d0ea70..6d5b74101fdb 100644 --- a/core/src/main/scala/org/apache/spark/status/api/v1/api.scala +++ b/core/src/main/scala/org/apache/spark/status/api/v1/api.scala @@ -391,11 +391,3 @@ case class ThreadStackTrace( val blockedByLock: String, val holdingLocks: Seq[String]) -class ExecutionData (val id : Long, - val status: String, - val description: String, - val submissionTime: String, - val duration: String, - val runningJobs: Seq[Int], - val successJobs: Seq[Int], - val failedJobs: Seq[Int]) diff --git a/sql/core/src/main/scala/org/apache/spark/status/api/v1/SqlResource.scala b/sql/core/src/main/scala/org/apache/spark/status/api/v1/SqlResource.scala index be8c7f47231f..21e771c9671c 100644 --- a/sql/core/src/main/scala/org/apache/spark/status/api/v1/SqlResource.scala +++ b/sql/core/src/main/scala/org/apache/spark/status/api/v1/SqlResource.scala @@ -48,9 +48,10 @@ private[v1] class SqlResource extends BaseAppResource { withUI { ui => val sqlStore = new SQLAppStatusStore(ui.store.store) - sqlStore.executionsList() - .filter(execution => execution.executionId == execId) + sqlStore + .execution(execId) .map(exec => prepareExecutionData(exec)) + .toSeq } } @@ -59,15 +60,14 @@ private[v1] class SqlResource extends BaseAppResource { var completed = Seq[Int]() var failed = Seq[Int]() - exec.jobs.map { job => - job match { - case (id, status) if status == JobExecutionStatus.RUNNING => - running = running :+ id - case (id, status) if status == JobExecutionStatus.SUCCEEDED => - completed = completed :+ id - case (id, status) if status == JobExecutionStatus.FAILED => - failed = failed :+ id - } + exec.jobs.foreach { + case (id, JobExecutionStatus.RUNNING) => + running = running :+ id + case (id, JobExecutionStatus.SUCCEEDED ) => + completed = completed :+ id + case (id, JobExecutionStatus.FAILED) => + failed = failed :+ id + case _ => } val status = if (exec.jobs.size == completed.size) { diff --git a/sql/core/src/main/scala/org/apache/spark/status/api/v1/api.scala b/sql/core/src/main/scala/org/apache/spark/status/api/v1/api.scala new file mode 100644 index 000000000000..8133166bdd25 --- /dev/null +++ b/sql/core/src/main/scala/org/apache/spark/status/api/v1/api.scala @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.spark.status.api.v1 + +class ExecutionData (val id : Long, + val status: String, + val description: String, + val submissionTime: String, + val duration: String, + val runningJobIds: Seq[Int], + val successJobIds: Seq[Int], + val failedJobIds: Seq[Int])