From 16d8360592ef30d00337828e6ce1f4466660c1d2 Mon Sep 17 00:00:00 2001 From: Mark DePristo Date: Wed, 24 Aug 2011 13:59:14 -0400 Subject: [PATCH] QJobReport is now the official capability name --- .../sting/queue/QCommandLine.scala | 5 ++-- .../sting/queue/engine/QGraphSettings.scala | 3 +++ .../{JobLogging.scala => QJobReport.scala} | 26 ++++++++++--------- 3 files changed, 19 insertions(+), 15 deletions(-) rename public/scala/src/org/broadinstitute/sting/queue/util/{JobLogging.scala => QJobReport.scala} (84%) diff --git a/public/scala/src/org/broadinstitute/sting/queue/QCommandLine.scala b/public/scala/src/org/broadinstitute/sting/queue/QCommandLine.scala index c6d1f3883..668bd9604 100755 --- a/public/scala/src/org/broadinstitute/sting/queue/QCommandLine.scala +++ b/public/scala/src/org/broadinstitute/sting/queue/QCommandLine.scala @@ -115,9 +115,8 @@ class QCommandLine extends CommandLineProgram with Logging { // walk over each script, calling onExecutionDone for (script <- allQScripts) { script.onExecutionDone(qGraph.getFunctionsAndStatus(script.functions), qGraph.success) - val reportFile = new File("joblogging.gatkreport.txt") - logger.info("Writing JobLogging GATKReport to file " + reportFile) - JobLogging.printLogs(qGraph.getFunctionsAndStatus(script.functions), reportFile) + logger.info("Writing JobLogging GATKReport to file " + settings.jobReportFile) + QJobReport.printReport(qGraph.getFunctionsAndStatus(script.functions), settings.jobReportFile) } if (!qGraph.success) { diff --git a/public/scala/src/org/broadinstitute/sting/queue/engine/QGraphSettings.scala b/public/scala/src/org/broadinstitute/sting/queue/engine/QGraphSettings.scala index 6ece600dd..13c841778 100644 --- a/public/scala/src/org/broadinstitute/sting/queue/engine/QGraphSettings.scala +++ b/public/scala/src/org/broadinstitute/sting/queue/engine/QGraphSettings.scala @@ -69,6 +69,9 @@ class QGraphSettings { @Argument(fullName="expanded_dot_graph", shortName="expandedDot", doc="Outputs the queue graph of scatter gather to a .dot file. Otherwise overwrites the dot_graph", required=false) var expandedDotFile: File = _ + @Argument(fullName="jobReport", shortName="jobReport", doc="File where we will write the Queue job report", required=false) + var jobReportFile: File = new File("queue_job_report.gatkreport.txt") + @ArgumentCollection val qSettings = new QSettings } diff --git a/public/scala/src/org/broadinstitute/sting/queue/util/JobLogging.scala b/public/scala/src/org/broadinstitute/sting/queue/util/QJobReport.scala similarity index 84% rename from public/scala/src/org/broadinstitute/sting/queue/util/JobLogging.scala rename to public/scala/src/org/broadinstitute/sting/queue/util/QJobReport.scala index 3bb43508a..882831f6b 100644 --- a/public/scala/src/org/broadinstitute/sting/queue/util/JobLogging.scala +++ b/public/scala/src/org/broadinstitute/sting/queue/util/QJobReport.scala @@ -32,7 +32,7 @@ import java.io.{FileOutputStream, PrintStream, File} /** * A mixin to add Job info to the class */ -trait JobLogging extends QFunction { +trait QJobReport extends QFunction { private var group: String = _ private var features: Map[String, String] = null @@ -70,16 +70,18 @@ trait JobLogging extends QFunction { } } -object JobLogging { - def printLogs(jobs: Map[QFunction, JobRunInfo], dest: File) { - val jobLogs: List[JobLogging] = jobLoggingSublist(jobs.keys.toList) - jobLogs.foreach((job: JobLogging) => job.addRunInfo(jobs.get(job).get)) - printJobLogging(jobLogs, new PrintStream(new FileOutputStream(dest))) +object QJobReport { + def printReport(jobs: Map[QFunction, JobRunInfo], dest: File) { + val jobLogs: List[QJobReport] = jobLoggingSublist(jobs.keys.toList) + jobLogs.foreach((job: QJobReport) => job.addRunInfo(jobs.get(job).get)) + val stream = new PrintStream(new FileOutputStream(dest)) + printJobLogging(jobLogs, stream) + stream.close() } - private def jobLoggingSublist(l: List[QFunction]): List[JobLogging] = { - def asJogLogging(qf: QFunction): JobLogging = qf match { - case x: JobLogging => x + private def jobLoggingSublist(l: List[QFunction]): List[QJobReport] = { + def asJogLogging(qf: QFunction): QJobReport = qf match { + case x: QJobReport => x case _ => null } @@ -90,7 +92,7 @@ object JobLogging { * Prints the JobLogging logs to a GATKReport. First splits up the * logs by group, and for each group generates a GATKReportTable */ - private def printJobLogging(logs: List[JobLogging], stream: PrintStream) { + private def printJobLogging(logs: List[QJobReport], stream: PrintStream) { // create the report val report: GATKReport = new GATKReport @@ -112,11 +114,11 @@ object JobLogging { report.print(stream) } - private def groupLogs(logs: List[JobLogging]): Map[String, List[JobLogging]] = { + private def groupLogs(logs: List[QJobReport]): Map[String, List[QJobReport]] = { logs.groupBy(_.getGroup) } - private def logKeys(logs: List[JobLogging]): Set[String] = { + private def logKeys(logs: List[QJobReport]): Set[String] = { // the keys should be the same for each log, but we will check that val keys = Set[String](logs(0).getFeatureNames : _*)