Commit ce1562d1 authored by Peter van 't Hof's avatar Peter van 't Hof

Refactor code to safe retry

parent 173d24e7
...@@ -19,7 +19,6 @@ import java.io.File ...@@ -19,7 +19,6 @@ import java.io.File
import nl.lumc.sasc.biopet.core.summary.{ SummaryQScript, WriteSummary } import nl.lumc.sasc.biopet.core.summary.{ SummaryQScript, WriteSummary }
import nl.lumc.sasc.biopet.utils.config.Configurable import nl.lumc.sasc.biopet.utils.config.Configurable
import nl.lumc.sasc.biopet.core.report.ReportBuilderExtension import nl.lumc.sasc.biopet.core.report.ReportBuilderExtension
import nl.lumc.sasc.biopet.core.workaround.BiopetQCommandLine
import nl.lumc.sasc.biopet.utils.Logging import nl.lumc.sasc.biopet.utils.Logging
import org.broadinstitute.gatk.queue.{ QScript, QSettings } import org.broadinstitute.gatk.queue.{ QScript, QSettings }
import org.broadinstitute.gatk.queue.function.QFunction import org.broadinstitute.gatk.queue.function.QFunction
...@@ -118,11 +117,10 @@ trait BiopetQScript extends Configurable with GatkLogging { qscript: QScript => ...@@ -118,11 +117,10 @@ trait BiopetQScript extends Configurable with GatkLogging { qscript: QScript =>
} }
functions.filter(_.jobOutputFile == null).foreach(f => { functions.filter(_.jobOutputFile == null).foreach(f => {
try { val className = if (f.getClass.isAnonymousClass) f.getClass.getSuperclass.getSimpleName else f.getClass.getSimpleName
val className = if (f.getClass.isAnonymousClass) f.getClass.getSuperclass.getSimpleName else f.getClass.getSimpleName BiopetQScript.safeOutputs(f) match {
f.jobOutputFile = new File(f.firstOutput.getAbsoluteFile.getParent, "." + f.firstOutput.getName + "." + className + ".out") case Some(o) => f.jobOutputFile = new File(o.head.getAbsoluteFile.getParent, "." + f.firstOutput.getName + "." + className + ".out")
} catch { case _ => f.jobOutputFile = new File("./stdout") // Line is here for test backup
case e: NullPointerException => logger.warn(s"Can't generate a jobOutputFile for $f")
} }
}) })
...@@ -159,7 +157,7 @@ trait BiopetQScript extends Configurable with GatkLogging { qscript: QScript => ...@@ -159,7 +157,7 @@ trait BiopetQScript extends Configurable with GatkLogging { qscript: QScript =>
case that: BiopetQScript => case that: BiopetQScript =>
that.init() that.init()
that.biopetScript() that.biopetScript()
case _ => subPipeline.script case _ => subPipeline.script()
} }
addAll(subPipeline.functions) addAll(subPipeline.functions)
} }
......
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