From 0848eb1092bfb938ec7703abe6cecc19e978aa6e Mon Sep 17 00:00:00 2001 From: Peter van 't Hof <p.j.van_t_hof@lumc.nl> Date: Mon, 2 Nov 2015 12:14:27 +0100 Subject: [PATCH] Added a default for the retry arg --- .../nl/lumc/sasc/biopet/core/PipelineCommand.scala | 10 +++++++++- .../nl/lumc/sasc/biopet/utils/config/Config.scala | 12 ++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/public/biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/PipelineCommand.scala b/public/biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/PipelineCommand.scala index dcede5257..928bee57a 100644 --- a/public/biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/PipelineCommand.scala +++ b/public/biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/PipelineCommand.scala @@ -18,13 +18,14 @@ package nl.lumc.sasc.biopet.core import java.io.{ File, PrintWriter } import nl.lumc.sasc.biopet.utils.config.Config +import nl.lumc.sasc.biopet.utils.ConfigUtils.ImplicitConversions import nl.lumc.sasc.biopet.core.workaround.BiopetQCommandLine import nl.lumc.sasc.biopet.utils.{ MainCommand, Logging } import org.apache.log4j.{ PatternLayout, WriterAppender } import org.broadinstitute.gatk.queue.util.{ Logging => GatkLogging } /** Wrapper around executable from Queue */ -trait PipelineCommand extends MainCommand with GatkLogging { +trait PipelineCommand extends MainCommand with GatkLogging with ImplicitConversions { /** * Gets location of compiled class of pipeline @@ -32,6 +33,8 @@ trait PipelineCommand extends MainCommand with GatkLogging { */ def pipeline = "/" + getClass.getName.stripSuffix("$").replaceAll("\\.", "/") + ".class" + def pipelineName = getClass.getSimpleName.takeWhile(_ != '$').toLowerCase + /** Class can be used directly from java with -cp option */ def main(args: Array[String]): Unit = { val argsSize = args.length @@ -87,6 +90,11 @@ trait PipelineCommand extends MainCommand with GatkLogging { if (!args.contains("--log_to_file") && !args.contains("-log")) { argv ++= List("--log_to_file", new File(logFile.getParentFile, "queue." + BiopetQCommandLine.timestamp + ".log").getAbsolutePath) } + if (!args.contains("-retry") && !args.contains("--retry_failed")) { + val retry: Int = Config.global(pipelineName, Nil, "retry", default = 5) + logger.info("No retry flag found, ") + argv ++= List("-retry", retry.toString) + } BiopetQCommandLine.main(argv) } } \ No newline at end of file diff --git a/public/biopet-utils/src/main/scala/nl/lumc/sasc/biopet/utils/config/Config.scala b/public/biopet-utils/src/main/scala/nl/lumc/sasc/biopet/utils/config/Config.scala index 4c69bf57c..a3b8a8ab0 100644 --- a/public/biopet-utils/src/main/scala/nl/lumc/sasc/biopet/utils/config/Config.scala +++ b/public/biopet-utils/src/main/scala/nl/lumc/sasc/biopet/utils/config/Config.scala @@ -168,12 +168,12 @@ class Config(protected var _map: Map[String, Any], * @param freeVar Default true, if set false value must exist in module * @return Config value */ - protected[config] def apply(module: String, - path: List[String], - key: String, - default: Any = null, - freeVar: Boolean = true, - fixedValues: Map[String, Any] = Map()): ConfigValue = { + def apply(module: String, + path: List[String], + key: String, + default: Any = null, + freeVar: Boolean = true, + fixedValues: Map[String, Any] = Map()): ConfigValue = { val requestedIndex = ConfigValueIndex(module, path, key, freeVar) if (contains(requestedIndex, fixedValues)) { val fixedValue = fixedCache.get(requestedIndex) -- GitLab