diff --git a/public/biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/CommandLineResources.scala b/public/biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/CommandLineResources.scala index 2eb25691a6d30746ed81ae54f7a79d718d513499..6334b3cbfc1f02bb28d2085ef791939dafd388b2 100644 --- a/public/biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/CommandLineResources.scala +++ b/public/biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/CommandLineResources.scala @@ -6,18 +6,17 @@ import nl.lumc.sasc.biopet.utils.config.Configurable import org.broadinstitute.gatk.queue.function.CommandLineFunction /** - * Created by pjvanthof on 01/10/15. + * This trait will control resources given to a CommandlineFunction */ trait CommandLineResources extends CommandLineFunction with Configurable { def defaultThreads = 1 final def threads = nCoresRequest match { case Some(i) => i - case _ => { + case _ => val t = getThreads nCoresRequest = Some(t) t - } } var vmem: Option[String] = config("vmem") @@ -64,23 +63,26 @@ trait CommandLineResources extends CommandLineFunction with Configurable { nCoresRequest = Option(threads) + /** The 1e retry does not yet upgrade the memory */ + val retryMultipler = if (retry > 1) retry - 1 else 0 + _coreMemory = config("core_memory", default = defaultCoreMemory).asDouble + - (0.5 * retry) + (0.5 * retryMultipler) if (config.contains("memory_limit")) memoryLimit = config("memory_limit") else memoryLimit = Some(_coreMemory * threads) if (config.contains("resident_limit")) residentLimit = config("resident_limit") - else residentLimit = Some((_coreMemory + (0.5 * retry)) * residentFactor) + else residentLimit = Some((_coreMemory + (0.5 * retryMultipler)) * residentFactor) - if (!config.contains("vmem")) vmem = Some((_coreMemory * (vmemFactor + (0.5 * retry))) + "G") + if (!config.contains("vmem")) vmem = Some((_coreMemory * (vmemFactor + (0.5 * retryMultipler))) + "G") jobName = configName + ":" + (if (firstOutput != null) firstOutput.getName else jobOutputFile) } override def setupRetry(): Unit = { super.setupRetry() if (vmem.isDefined) jobResourceRequests = jobResourceRequests.filterNot(_.contains("h_vmem=")) - logger.info("Auto raise memory on retry") + if (retry > 0) logger.info("Auto raise memory on retry") retry += 1 this.freeze() }