From 919cafa32d24192046ed4f52305189ea695d3f12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ste=CC=81phane=20Cottin?= Date: Thu, 31 Aug 2017 02:20:58 +0200 Subject: [PATCH] Revert "apply https://github.com/mesos/chronos/pull/845" This reverts commit cb35b20a0457c4a733513091a3a1607ef3d3c9fa. --- .../scheduler/api/JobManagementResource.scala | 13 +++++++++++-- .../mesos/chronos/scheduler/graph/JobGraph.scala | 9 --------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/scala/org/apache/mesos/chronos/scheduler/api/JobManagementResource.scala b/src/main/scala/org/apache/mesos/chronos/scheduler/api/JobManagementResource.scala index cb139cba2..609bf837d 100644 --- a/src/main/scala/org/apache/mesos/chronos/scheduler/api/JobManagementResource.scala +++ b/src/main/scala/org/apache/mesos/chronos/scheduler/api/JobManagementResource.scala @@ -324,7 +324,11 @@ class JobManagementResource @Inject()(val jobScheduler: JobScheduler, @Timed def getSummary(): Response = { try { - val jobs = jobGraph.transformVertextSet(j => jobGraph.getJobForName(j)) + import scala.collection.JavaConversions._ + val jobs = jobGraph.dag.vertexSet() + .flatMap { + jobGraph.getJobForName + } .map { job => val state = Exporter.getLastState(job).toString @@ -364,7 +368,12 @@ class JobManagementResource @Inject()(val jobScheduler: JobScheduler, @QueryParam("offset") offset: Integer ) = { try { - val jobs = jobGraph.transformVertextSet(j => jobGraph.getJobForName(j)) + val jobs = ListBuffer[BaseJob]() + import scala.collection.JavaConversions._ + jobGraph.dag.vertexSet().map({ + job => + jobs += jobGraph.getJobForName(job).get + }) val _limit: Integer = limit match { case x: Integer => diff --git a/src/main/scala/org/apache/mesos/chronos/scheduler/graph/JobGraph.scala b/src/main/scala/org/apache/mesos/chronos/scheduler/graph/JobGraph.scala index abcb4c377..beafe838d 100644 --- a/src/main/scala/org/apache/mesos/chronos/scheduler/graph/JobGraph.scala +++ b/src/main/scala/org/apache/mesos/chronos/scheduler/graph/JobGraph.scala @@ -12,7 +12,6 @@ import org.jgrapht.graph.DefaultEdge import scala.collection.convert.decorateAsScala._ import scala.collection.mutable.ListBuffer import scala.collection.{mutable, _} -import scala.collection.JavaConverters._ /** * This class provides methods to access dependency structures of jobs. @@ -53,14 +52,6 @@ class JobGraph { Some(parents) } - - def transformVertextSet[T](f: String => Option[T]): Set[T] = { - lock.synchronized { - dag.vertexSet().asScala.flatMap(vertex => f(vertex)) - } - } - - def getJobForName(name: String): Option[BaseJob] = { jobNameMapping.get(name) }