From a4bacc878af4dc211dcdf388547a0ea4e8f72717 Mon Sep 17 00:00:00 2001 From: Peter van 't Hof <p.j.van_t_hof@lumc.nl> Date: Mon, 23 Jun 2014 12:54:00 +0200 Subject: [PATCH] Moved getThreads to BiopetCommandLineFunction --- .../core/BiopetCommandLineFunction.scala | 23 +++++++++++-------- .../biopet/core/config/Configurable.scala | 15 ------------ 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetCommandLineFunction.scala b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetCommandLineFunction.scala index a56ed05d8..bf8fe4d04 100644 --- a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetCommandLineFunction.scala +++ b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetCommandLineFunction.scala @@ -9,11 +9,7 @@ import scala.util.matching.Regex import nl.lumc.sasc.biopet.core.config._ abstract class BiopetCommandLineFunction extends CommandLineFunction with Configurable { -// val globalConfig: Config analysisName = getClass.getSimpleName -// protected var config: Config = Config.mergeConfigs(globalConfig.getAsConfig(analysisName.toLowerCase), globalConfig) -// logger.debug("config passed for " + analysisName) -// logger.debug("config for " + analysisName + ": " + config) @Input(doc="deps", required=false) var deps: List[File] = Nil @@ -35,11 +31,6 @@ abstract class BiopetCommandLineFunction extends CommandLineFunction with Config protected def afterGraph { } -// def setConfig(name:String) { -// analysisName = name -// config = Config.mergeConfigs(config.getAsConfig(analysisName.toLowerCase), config) -// } - override def freezeFieldValues() { checkExecuteble afterGraph @@ -115,4 +106,18 @@ abstract class BiopetCommandLineFunction extends CommandLineFunction with Config logger.warn("Version command: '" + versionCommand + "' give a exit code 0 but no version was found, executeble oke?") return "N/A" } + + def getThreads(default:Int) : Int = { + val maxThreads: Int = config("maxthreads", 8) + val threads: Int = config("threads", default) + if (maxThreads > threads) return threads + else return maxThreads + } + + def getThreads(default:Int, module:String) : Int = { + val maxThreads: Int = config("maxthreads", 8, module) + val threads: Int = config("threads", default, module) + if (maxThreads > threads) return threads + else return maxThreads + } } diff --git a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/config/Configurable.scala b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/config/Configurable.scala index ecb93d81e..884d36b61 100644 --- a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/config/Configurable.scala +++ b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/config/Configurable.scala @@ -28,21 +28,6 @@ trait Configurable extends Logging { implicit def configValue2stringList(value:ConfigValue) = Configurable.any2stringList(value.value) implicit def configValue2stringSet(value:ConfigValue) = Configurable.any2stringList(value.value).toSet implicit def configValue2map(value:ConfigValue) = Configurable.any2map(value.value) - - - def getThreads(default:Int) : Int = { - val maxThreads: Int = config("maxthreads", 8) - val threads: Int = config("threads", default) - if (maxThreads > threads) return threads - else return maxThreads - } - - def getThreads(default:Int, module:String) : Int = { - val maxThreads: Int = config("maxthreads", 8, module) - val threads: Int = config("threads", default, module) - if (maxThreads > threads) return threads - else return maxThreads - } } object Configurable extends Logging { -- GitLab