Skip to content
Snippets Groups Projects
Commit c7dddadd authored by Wai Yi Leung's avatar Wai Yi Leung
Browse files

Merge branch 'patch-meta_in_summary' into 'develop'

Patch meta in summary

This pull request adds a `meta` entry to the root of each summary JSON file. The contents of the meta is:

`last_commit_hash`: the commit hash of the repository when the JAR was built. If the repository has uncommitted changes, `-dirty` is appended to the commit hash.

`pipeline_version`: the version of the pipeline (the one we put in the `pom.xml` file).

This information is static across all modules and subpipelines to any given pipeline run, so I decided to put this in the root.

See merge request !144
parents 81fa8685 0e5a2fad
No related branches found
No related tags found
No related merge requests found
......@@ -15,17 +15,17 @@
*/
package nl.lumc.sasc.biopet.core.summary
import java.io.{ FileInputStream, PrintWriter, File }
import java.security.MessageDigest
import java.io.{ File, PrintWriter }
import scala.collection.mutable
import scala.io.Source
import nl.lumc.sasc.biopet.core.{ BiopetJavaCommandLineFunction, BiopetCommandLineFunction, BiopetCommandLineFunctionTrait, SampleLibraryTag }
import nl.lumc.sasc.biopet.core.config.Configurable
import nl.lumc.sasc.biopet.utils.ConfigUtils
import org.broadinstitute.gatk.queue.function.{ QFunction, InProcessFunction }
import org.broadinstitute.gatk.utils.commandline.{ Output, Input }
import scala.collection.mutable
import scala.io.Source
import nl.lumc.sasc.biopet.{ LastCommitHash, Version }
import nl.lumc.sasc.biopet.core.{ BiopetJavaCommandLineFunction, BiopetCommandLineFunction, BiopetCommandLineFunctionTrait, SampleLibraryTag }
import nl.lumc.sasc.biopet.core.config.Configurable
import nl.lumc.sasc.biopet.utils.ConfigUtils
/**
* Created by pjvan_thof on 2/14/15.
......@@ -106,9 +106,13 @@ class WriteSummary(val root: Configurable) extends InProcessFunction with Config
(v1: Any, v2: Any, key: String) => summarizable.resolveSummaryConflict(v1, v2, key))
}).foldRight(pipelineMap)((a, b) => ConfigUtils.mergeMaps(a._1, b, a._2))
val combinedMap = (for (qscript <- qscript.summaryQScripts) yield {
ConfigUtils.fileToConfigMap(qscript.summaryFile)
}).foldRight(jobsMap)((a, b) => ConfigUtils.mergeMaps(a, b))
val combinedMap = Map("meta" -> Map(
"last_commit_hash" -> LastCommitHash,
"pipeline_version" -> Version
)) ++
(for (qscript <- qscript.summaryQScripts) yield {
ConfigUtils.fileToConfigMap(qscript.summaryFile)
}).foldRight(jobsMap)((a, b) => ConfigUtils.mergeMaps(a, b))
val writer = new PrintWriter(out)
writer.println(ConfigUtils.mapToJson(combinedMap).spaces4)
......
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