Skip to content
Snippets Groups Projects
Commit d8365524 authored by bow's avatar bow
Browse files

Merge branch 'feature-cach_version' into 'develop'

Feature cach version

See #84

See merge request !35
parents 11f7fe0a 16068896
No related branches found
No related tags found
No related merge requests found
......@@ -92,7 +92,7 @@ trait BiopetCommandLineFunctionTrait extends CommandLineFunction with Configurab
protected def versionCommand: String = null
protected val versionRegex: Regex = null
protected val versionExitcode = List(0) // Can select multiple
def getVersion: String = {
private def getVersionInternal: String = {
if (versionCommand == null || versionRegex == null) return "N/A"
val stdout = new StringBuffer()
val stderr = new StringBuffer()
......@@ -114,6 +114,12 @@ trait BiopetCommandLineFunctionTrait extends CommandLineFunction with Configurab
return "N/A"
}
def getVersion: String = {
if (!BiopetCommandLineFunctionTrait.versionCache.contains(executable))
BiopetCommandLineFunctionTrait.versionCache += executable -> getVersionInternal
return BiopetCommandLineFunctionTrait.versionCache(executable)
}
def getThreads(default: Int): Int = {
val maxThreads: Int = config("maxthreads", default = 8)
val threads: Int = config("threads", default = default)
......@@ -128,3 +134,8 @@ trait BiopetCommandLineFunctionTrait extends CommandLineFunction with Configurab
else return maxThreads
}
}
object BiopetCommandLineFunctionTrait {
import scala.collection.mutable.Map
private val versionCache: Map[String, String] = Map()
}
\ No newline at end of file
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