Skip to content
Snippets Groups Projects
Commit a4bacc87 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Moved getThreads to BiopetCommandLineFunction

parent ea4f80e1
No related branches found
No related tags found
No related merge requests found
...@@ -9,11 +9,7 @@ import scala.util.matching.Regex ...@@ -9,11 +9,7 @@ import scala.util.matching.Regex
import nl.lumc.sasc.biopet.core.config._ import nl.lumc.sasc.biopet.core.config._
abstract class BiopetCommandLineFunction extends CommandLineFunction with Configurable { abstract class BiopetCommandLineFunction extends CommandLineFunction with Configurable {
// val globalConfig: Config
analysisName = getClass.getSimpleName 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) @Input(doc="deps", required=false)
var deps: List[File] = Nil var deps: List[File] = Nil
...@@ -35,11 +31,6 @@ abstract class BiopetCommandLineFunction extends CommandLineFunction with Config ...@@ -35,11 +31,6 @@ abstract class BiopetCommandLineFunction extends CommandLineFunction with Config
protected def afterGraph { protected def afterGraph {
} }
// def setConfig(name:String) {
// analysisName = name
// config = Config.mergeConfigs(config.getAsConfig(analysisName.toLowerCase), config)
// }
override def freezeFieldValues() { override def freezeFieldValues() {
checkExecuteble checkExecuteble
afterGraph afterGraph
...@@ -115,4 +106,18 @@ abstract class BiopetCommandLineFunction extends CommandLineFunction with Config ...@@ -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?") logger.warn("Version command: '" + versionCommand + "' give a exit code 0 but no version was found, executeble oke?")
return "N/A" 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 { ...@@ -28,21 +28,6 @@ trait Configurable extends Logging {
implicit def configValue2stringList(value:ConfigValue) = Configurable.any2stringList(value.value) implicit def configValue2stringList(value:ConfigValue) = Configurable.any2stringList(value.value)
implicit def configValue2stringSet(value:ConfigValue) = Configurable.any2stringList(value.value).toSet implicit def configValue2stringSet(value:ConfigValue) = Configurable.any2stringList(value.value).toSet
implicit def configValue2map(value:ConfigValue) = Configurable.any2map(value.value) 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 { object Configurable extends Logging {
......
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