Skip to content
Snippets Groups Projects
Commit 25690fa1 authored by Wai Yi Leung's avatar Wai Yi Leung
Browse files

Merge branch 'feature-auto_retry' into 'develop'

Added a default for the retry arg

Small option to add retry by default, also can use the config to set retries now

See merge request !264
parents a80e2427 0848eb10
No related branches found
No related tags found
No related merge requests found
......@@ -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
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment