Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -324,11 +324,7 @@ class JobManagementResource @Inject()(val jobScheduler: JobScheduler,
@Timed
def getSummary(): Response = {
try {
import scala.collection.JavaConversions._
val jobs = jobGraph.dag.vertexSet()
.flatMap {
jobGraph.getJobForName
}
val jobs = jobGraph.transformVertextSet(j => jobGraph.getJobForName(j))
.map {
job =>
val state = Exporter.getLastState(job).toString
Expand Down Expand Up @@ -368,12 +364,7 @@ class JobManagementResource @Inject()(val jobScheduler: JobScheduler,
@QueryParam("offset") offset: Integer
) = {
try {
val jobs = ListBuffer[BaseJob]()
import scala.collection.JavaConversions._
jobGraph.dag.vertexSet().map({
job =>
jobs += jobGraph.getJobForName(job).get
})
val jobs = jobGraph.transformVertextSet(j => jobGraph.getJobForName(j))

val _limit: Integer = limit match {
case x: Integer =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ 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.
Expand Down Expand Up @@ -52,6 +53,14 @@ 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)
}
Expand Down