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

Adding more information for each executable to summary

parent 9a37f7d6
......@@ -156,7 +156,13 @@ trait BiopetCommandLineFunctionTrait extends CommandLineFunction with Configurab
protected val versionExitcode = List(0)
/** Executes the version command */
private def getVersionInternal: Option[String] = {
private[core] def getVersionInternal(): Option[String] = {
if (versionCommand == null || versionRegex == null) None
else getVersionInternal(versionCommand, versionRegex)
}
/** Executes the version command */
private[core] def getVersionInternal(versionCommand: String, versionRegex: Regex): Option[String] = {
if (versionCommand == null || versionRegex == null) return None
val exe = new File(versionCommand.trim.split(" ")(0))
if (!exe.exists()) return None
......@@ -221,7 +227,7 @@ trait BiopetCommandLineFunctionTrait extends CommandLineFunction with Configurab
/** stores global caches */
object BiopetCommandLineFunctionTrait {
import scala.collection.mutable.Map
private val versionCache: Map[String, String] = Map()
private[core] val versionCache: Map[String, String] = Map()
private[core] val executableMd5Cache: Map[String, String] = Map()
private val executableCache: Map[String, String] = Map()
private[core] val executableCache: Map[String, String] = Map()
}
......@@ -37,6 +37,19 @@ trait BiopetJavaCommandLineFunction extends JavaCommandLineFunction with BiopetC
return cmd
}
def javaVersionCommand: String = executable + " -version"
def getJavaVersion: Option[String] = {
if (!BiopetCommandLineFunctionTrait.executableCache.contains(executable))
preProcesExecutable
if (!BiopetCommandLineFunctionTrait.versionCache.contains(javaVersionCommand))
getVersionInternal(javaVersionCommand, """java version "(.*)"""".r) match {
case Some(version) => BiopetCommandLineFunctionTrait.versionCache += javaVersionCommand -> version
case _ =>
}
BiopetCommandLineFunctionTrait.versionCache.get(javaVersionCommand)
}
override def setupRetry(): Unit = {
super.setupRetry()
javaMemoryLimit = memoryLimit
......
......@@ -74,11 +74,13 @@ class WriteSummary(val root: Configurable) extends InProcessFunction with Config
case f: BiopetJavaCommandLineFunction => {
f.configName -> Map("version" -> f.getVersion.getOrElse(None),
"java_md5" -> BiopetCommandLineFunctionTrait.executableMd5Cache.getOrElse(f.executable, None),
"jar_md5" -> SummaryQScript.md5sumCache.getOrElse(f.jarFile, None))
"java_version" -> f.getJavaVersion,
"jar_path" -> f.jarFile)
}
case f: BiopetCommandLineFunction => {
f.configName -> Map("version" -> f.getVersion.getOrElse(None),
"md5" -> BiopetCommandLineFunctionTrait.executableMd5Cache.getOrElse(f.executable, None))
"md5" -> BiopetCommandLineFunctionTrait.executableMd5Cache.getOrElse(f.executable, None),
"path" -> f.executable)
}
case _ => throw new IllegalStateException("This should not be possible")
}
......
Markdown is supported
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