Commit a4bacc87 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Moved getThreads to BiopetCommandLineFunction

parent ea4f80e1
......@@ -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
}
}
......@@ -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 {
......
Supports Markdown
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