Skip to content
Snippets Groups Projects
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
Branches
Tags
No related merge requests found
...@@ -156,7 +156,13 @@ trait BiopetCommandLineFunctionTrait extends CommandLineFunction with Configurab ...@@ -156,7 +156,13 @@ trait BiopetCommandLineFunctionTrait extends CommandLineFunction with Configurab
protected val versionExitcode = List(0) protected val versionExitcode = List(0)
/** Executes the version command */ /** 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 if (versionCommand == null || versionRegex == null) return None
val exe = new File(versionCommand.trim.split(" ")(0)) val exe = new File(versionCommand.trim.split(" ")(0))
if (!exe.exists()) return None if (!exe.exists()) return None
...@@ -221,7 +227,7 @@ trait BiopetCommandLineFunctionTrait extends CommandLineFunction with Configurab ...@@ -221,7 +227,7 @@ trait BiopetCommandLineFunctionTrait extends CommandLineFunction with Configurab
/** stores global caches */ /** stores global caches */
object BiopetCommandLineFunctionTrait { object BiopetCommandLineFunctionTrait {
import scala.collection.mutable.Map 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[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 ...@@ -37,6 +37,19 @@ trait BiopetJavaCommandLineFunction extends JavaCommandLineFunction with BiopetC
return cmd 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 = { override def setupRetry(): Unit = {
super.setupRetry() super.setupRetry()
javaMemoryLimit = memoryLimit javaMemoryLimit = memoryLimit
......
...@@ -74,11 +74,13 @@ class WriteSummary(val root: Configurable) extends InProcessFunction with Config ...@@ -74,11 +74,13 @@ class WriteSummary(val root: Configurable) extends InProcessFunction with Config
case f: BiopetJavaCommandLineFunction => { case f: BiopetJavaCommandLineFunction => {
f.configName -> Map("version" -> f.getVersion.getOrElse(None), f.configName -> Map("version" -> f.getVersion.getOrElse(None),
"java_md5" -> BiopetCommandLineFunctionTrait.executableMd5Cache.getOrElse(f.executable, 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 => { case f: BiopetCommandLineFunction => {
f.configName -> Map("version" -> f.getVersion.getOrElse(None), 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") case _ => throw new IllegalStateException("This should not be possible")
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment