Moved the test name and the job queue into the spec.
Defaulting to the hour queue for running pipeline tests. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5122 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
2ef66af903
commit
4ee4fd47e9
|
|
@ -3,12 +3,12 @@ package org.broadinstitute.sting.queue.pipeline
|
|||
import org.broadinstitute.sting.utils.Utils
|
||||
import org.testng.Assert
|
||||
import org.broadinstitute.sting.commandline.CommandLineProgram
|
||||
import org.broadinstitute.sting.queue.QCommandLine
|
||||
import java.io.File
|
||||
import org.broadinstitute.sting.queue.util.{TextFormatUtils, ProcessController}
|
||||
import java.util.Date
|
||||
import java.text.SimpleDateFormat
|
||||
import org.broadinstitute.sting.{WalkerTest, BaseTest}
|
||||
import org.broadinstitute.sting.queue.{QException, QCommandLine}
|
||||
|
||||
object PipelineTest {
|
||||
|
||||
|
|
@ -54,11 +54,14 @@ object PipelineTest {
|
|||
|
||||
val run = System.getProperty("pipeline.run") == "run"
|
||||
|
||||
def executeTest(name: String, pipelineTest: PipelineTestSpec) {
|
||||
def executeTest(pipelineTest: PipelineTestSpec) {
|
||||
val name = pipelineTest.name
|
||||
if (name == null)
|
||||
throw new QException("PipelineTestSpec.name is null.")
|
||||
println(Utils.dupString('-', 80));
|
||||
executeTest(name, pipelineTest.args, pipelineTest.expectedException)
|
||||
executeTest(name, pipelineTest.args, pipelineTest.jobQueue, pipelineTest.expectedException)
|
||||
if (run) {
|
||||
assertMatchingMD5s(name, pipelineTest.fileMD5s)
|
||||
assertMatchingMD5s(name, pipelineTest.fileMD5s.map{case (file, md5) => new File(runDir(name), file) -> md5})
|
||||
if (pipelineTest.evalSpec != null)
|
||||
validateEval(name, pipelineTest.evalSpec)
|
||||
println(" => %s PASSED".format(name))
|
||||
|
|
@ -109,14 +112,21 @@ object PipelineTest {
|
|||
* execute the test
|
||||
* @param name the name of the test
|
||||
* @param args the argument list
|
||||
* @param jobQueue the queue to run the job on. Defaults to hour if jobQueue is null.
|
||||
* @param expectedException the expected exception or null if no exception is expected.
|
||||
*/
|
||||
def executeTest(name: String, args: String, expectedException: Class[_]) {
|
||||
def executeTest(name: String, args: String, jobQueue: String, expectedException: Class[_]) {
|
||||
var command = Utils.escapeExpressions(args)
|
||||
|
||||
// add the logging level to each of the integration test commands
|
||||
|
||||
command = Utils.appendArray(command, "-bsub", "-l", "WARN", "-startFromScratch", "-tempDir", tempDir(name), "-runDir", runDir(name))
|
||||
|
||||
if (jobQueue == null)
|
||||
command = Utils.appendArray(command, "-jobQueue", "hour")
|
||||
else
|
||||
command = Utils.appendArray(command, "-jobQueue", jobQueue)
|
||||
|
||||
if (run)
|
||||
command = Utils.appendArray(command, "-run")
|
||||
|
||||
|
|
|
|||
|
|
@ -2,13 +2,16 @@ package org.broadinstitute.sting.queue.pipeline
|
|||
|
||||
import java.io.File
|
||||
|
||||
class PipelineTestSpec {
|
||||
class PipelineTestSpec(var name: String = null) {
|
||||
|
||||
/** The arguments to pass to the Queue test, ex: "-S scala/qscript/examples/HelloWorld.scala" */
|
||||
var args: String = _
|
||||
|
||||
/** Job Queue to run the test. Default is null which means use hour. */
|
||||
var jobQueue: String = _
|
||||
|
||||
/** Expected MD5 results for each file path. */
|
||||
var fileMD5s = Map.empty[File, String]
|
||||
var fileMD5s = Map.empty[String, String]
|
||||
|
||||
/** VariantEval validations to run on a VCF after the pipeline has completed. */
|
||||
var evalSpec: PipelineTestEvalSpec = _
|
||||
|
|
@ -16,7 +19,7 @@ class PipelineTestSpec {
|
|||
/** Expected exception from the test. */
|
||||
var expectedException: Class[_ <: Exception] = null
|
||||
|
||||
def this(args: String, fileMD5s: Traversable[(File, String)]) = {
|
||||
def this(args: String, fileMD5s: Traversable[(String, String)]) = {
|
||||
this()
|
||||
this.args = args
|
||||
this.fileMD5s = fileMD5s.toMap
|
||||
|
|
|
|||
|
|
@ -7,14 +7,13 @@ import org.broadinstitute.sting.BaseTest
|
|||
class ExampleCountLociPipelineTest {
|
||||
@Test
|
||||
def testCountLoci {
|
||||
var testName = "countloci"
|
||||
var testOut = "count.out"
|
||||
val spec = new PipelineTestSpec
|
||||
// TODO: Use a variable instead of "hour"
|
||||
spec.args = "-S scala/qscript/examples/ExampleCountLoci.scala -gatk %s -R %s -I %s -o %s -jobQueue hour".format(
|
||||
spec.name = "countloci"
|
||||
spec.args = "-S scala/qscript/examples/ExampleCountLoci.scala -gatk %s -R %s -I %s -o %s".format(
|
||||
PipelineTest.currentGATK, BaseTest.hg18Reference, BaseTest.validationDataLocation + "small_bam_for_countloci.bam", testOut
|
||||
)
|
||||
spec.fileMD5s += PipelineTest.fileMD5(testName, testOut, "67823e4722495eb10a5e4c42c267b3a6")
|
||||
PipelineTest.executeTest(testName, spec)
|
||||
spec.fileMD5s += testOut -> "67823e4722495eb10a5e4c42c267b3a6"
|
||||
PipelineTest.executeTest(spec)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ import org.broadinstitute.sting.queue.pipeline.{PipelineTest, PipelineTestSpec}
|
|||
class HelloWorldPipelineTest {
|
||||
@Test
|
||||
def testHelloWorld {
|
||||
var testName = "helloworld"
|
||||
val spec = new PipelineTestSpec
|
||||
spec.args = "-S scala/qscript/examples/HelloWorld.scala -jobPrefix HelloWorld -jobQueue hour"
|
||||
PipelineTest.executeTest(testName, spec)
|
||||
spec.name = "helloworld"
|
||||
spec.args = "-S scala/qscript/examples/HelloWorld.scala -jobPrefix HelloWorld"
|
||||
PipelineTest.executeTest(spec)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,8 +27,6 @@ class FullCallingPipelineTest {
|
|||
dataset.validations :+= new DoubleValidation("eval.dbsnp.all.called.known.titv.tiTvRatio", 3.7426)
|
||||
dataset.validations :+= new DoubleValidation("eval.dbsnp.all.called.novel.titv.tiTvRatio", 3.3077)
|
||||
|
||||
dataset.jobQueue = "hour"
|
||||
|
||||
dataset
|
||||
}
|
||||
|
||||
|
|
@ -101,11 +99,10 @@ class FullCallingPipelineTest {
|
|||
cleanType = "uncleaned"
|
||||
}
|
||||
|
||||
if (dataset.jobQueue != null)
|
||||
pipelineCommand += " -jobQueue " + dataset.jobQueue
|
||||
|
||||
val pipelineSpec = new PipelineTestSpec
|
||||
pipelineSpec.name = testName
|
||||
pipelineSpec.args = pipelineCommand
|
||||
pipelineSpec.jobQueue = dataset.jobQueue
|
||||
|
||||
pipelineSpec.evalSpec = new PipelineTestEvalSpec
|
||||
pipelineSpec.evalSpec.vcf = new File(PipelineTest.runDir(testName) + "SnpCalls/%s.%s.annotated.handfiltered.vcf".format(projectName, cleanType))
|
||||
|
|
@ -115,7 +112,7 @@ class FullCallingPipelineTest {
|
|||
pipelineSpec.evalSpec.validations = dataset.validations
|
||||
|
||||
// Run the test, at least checking if the command compiles
|
||||
PipelineTest.executeTest(testName, pipelineSpec)
|
||||
PipelineTest.executeTest(pipelineSpec)
|
||||
}
|
||||
|
||||
class PipelineDataset(
|
||||
|
|
|
|||
Loading…
Reference in New Issue