Commit 059e8836 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Added complete status to compress plots

parent 111adafc
...@@ -148,16 +148,16 @@ object PipelineStatus extends ToolCommand { ...@@ -148,16 +148,16 @@ object PipelineStatus extends ToolCommand {
val numberRegex = """(.*)_(\d*)$""".r val numberRegex = """(.*)_(\d*)$""".r
def compressOnType(jobs: Map[String, List[String]]): Map[String, List[String]] = { def compressOnType(jobs: Map[String, List[String]]): Map[String, List[String]] = {
val set = for ((job, deps) <- jobs.toSet; dep <- deps) yield { val set = for ((job, deps) <- jobs.toSet; dep <- deps) yield {
job match { (compressedName(job)._1, compressedName(dep)._1)
case numberRegex(name, number) => (name, dep match {
case numberRegex(name, number) => name
})
}
} }
// This will collapse a Set[(String, String)] to a Map[String, List[String]] // This will collapse a Set[(String, String)] to a Map[String, List[String]]
set.groupBy(_._1).map(x => x._1 -> x._2.map(_._2).toList) set.groupBy(_._1).map(x => x._1 -> x._2.map(_._2).toList)
} }
def compressedName(jobName: String) = jobName match {
case numberRegex(name, number) => (name, number.toInt)
}
def writeGraphvizFile(jobsDeps: Map[String, List[String]], def writeGraphvizFile(jobsDeps: Map[String, List[String]],
outputFile: File, outputFile: File,
jobDone: Set[String], jobDone: Set[String],
...@@ -171,12 +171,20 @@ object PipelineStatus extends ToolCommand { ...@@ -171,12 +171,20 @@ object PipelineStatus extends ToolCommand {
graph.foreach { case (job, jobDeps) => graph.foreach { case (job, jobDeps) =>
// Writing color of node // Writing color of node
if (jobDone.contains(job)) writer.println(s" $job [color = green]") val compressTotal = if (compress) Some(deps.jobs.keys.count(compressedName(_)._1 == job)) else None
else if (jobFailed.contains(job)) writer.println(s" $job [color = red]") val compressDone = if (compress) Some(jobDone.count(compressedName(_)._1 == job)) else None
else if (jobsStart.contains(job)) writer.println(s" $job [color = orange]") val compressFailed = if (compress) Some(jobFailed.count(compressedName(_)._1 == job)) else None
val compressStart = if (compress) Some(jobsStart.count(compressedName(_)._1 == job)) else None
val compressIntermediate = if (compress) Some(deps.jobs.filter(x => x._2.intermediate)
.count(x => compressedName(x._1)._1 == job)) else None
if (jobDone.contains(job) || compress && compressTotal == compressDone) writer.println(s" $job [color = green]")
else if (jobFailed.contains(job) || compress && compressTotal == compressFailed) writer.println(s" $job [color = red]")
else if (jobsStart.contains(job) || compress && compressTotal == compressStart) writer.println(s" $job [color = orange]")
// Dashed lined for intermediate jobs // Dashed lined for intermediate jobs
if (deps.jobs.contains(job) && deps.jobs(job).intermediate) writer.println(s" $job [style = dashed]") if ((deps.jobs.contains(job) && deps.jobs(job).intermediate) || (compress && compressTotal == compressIntermediate))
writer.println(s" $job [style = dashed]")
// Writing Node deps // Writing Node deps
jobDeps.foreach(c => writer.println(s" $c -> $job;")) jobDeps.foreach(c => writer.println(s" $c -> $job;"))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment