From 01323447c61deef27137c790ecf59b7b3e836c79 Mon Sep 17 00:00:00 2001 From: kshakir Date: Tue, 14 Dec 2010 19:57:20 +0000 Subject: [PATCH] Removed LibBat.SUB2_BSUB_BLOCK since the use of it exits the JVM. Fixed integration tests to wait on their own for the job to run instead of using SUB2_BSUB_BLOCK. Updated VariantRecalibrationIntegrationTests MD5s which were knocked out of sync whele SUB2_BSUB_BLOCK was exiting in the middle of integration tests. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4840 348d0f76-0448-11de-a6fe-93d51630548a --- .../sting/jna/lsf/v7_0_6/LibBat.java | 4 +-- ...ntRecalibrationWalkersIntegrationTest.java | 8 ++--- .../jna/lsf/v7_0_6/LibBatIntegrationTest.java | 36 ++++++++++++++++--- 3 files changed, 38 insertions(+), 10 deletions(-) diff --git a/java/src/org/broadinstitute/sting/jna/lsf/v7_0_6/LibBat.java b/java/src/org/broadinstitute/sting/jna/lsf/v7_0_6/LibBat.java index 63aa35aa1..6a4e21d77 100644 --- a/java/src/org/broadinstitute/sting/jna/lsf/v7_0_6/LibBat.java +++ b/java/src/org/broadinstitute/sting/jna/lsf/v7_0_6/LibBat.java @@ -4477,7 +4477,7 @@ public class LibBat { */ public static final int SUB2_MODIFY_CMD = 0x02; - /** + /**//* Removed access to SUB2_BSUB_BLOCK since it exits the process (including the JVM) with the exit code of the submitted job. -kshakir December 14, 2010 * < Submit a job in a synchronous * mode so that submission does not return until the job terminates. * Note once this flag is set, the \ref lsb_submit will never return if @@ -4486,7 +4486,7 @@ public class LibBat { * API call in the blocking mode and the parent process wait on the * child process (see wait() for details. */ - public static final int SUB2_BSUB_BLOCK = 0x04; + //public static final int SUB2_BSUB_BLOCK = 0x04; /** * < Submit from NT. diff --git a/java/test/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VariantRecalibrationWalkersIntegrationTest.java b/java/test/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VariantRecalibrationWalkersIntegrationTest.java index 201f7b298..a98235d79 100755 --- a/java/test/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VariantRecalibrationWalkersIntegrationTest.java +++ b/java/test/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VariantRecalibrationWalkersIntegrationTest.java @@ -30,15 +30,15 @@ public class VariantRecalibrationWalkersIntegrationTest extends WalkerTest { VRTest yriTrio = new VRTest("yri.trio.gatk_glftrio.intersection.annotated.filtered.chr1.vcf", "4eeffa7a1965ce0c25c5edd0bae76290", // in vcf - "7407987a0148284ed910e1858116dd8d", // tranches + "a04e00d00c991d76900634376bc1a9d1", // tranches "f34b36c1da8bcb080a584592d1f6dae7", // recalVCF - "1296ebde7dd61c1c58c11b07b31fd61b"); // cut VCF + "ee07ff6c0ff6108e00b131ce3c7a7f65"); // cut VCF VRTest lowPass = new VRTest("lowpass.N3.chr1.raw.vcf", "8937a3ae7f176dacf47b8ee6c0023416", // in vcf - "2896657b5c30bfd8e82e62e58d94ef4e", // tranches + "8da48dec888c9d4e3c3c7ed7943c0c61", // tranches "ae6a1e0874c966312e891b5a3c47b0e3", // recalVCF - "5eed2030d513fae05e45468fa0bb1538"); // cut VCF + "3ac16abdc5bbd5148f0cf88e8a7af3c9"); // cut VCF @DataProvider(name = "VRTest") public Object[][] createData1() { diff --git a/java/test/org/broadinstitute/sting/jna/lsf/v7_0_6/LibBatIntegrationTest.java b/java/test/org/broadinstitute/sting/jna/lsf/v7_0_6/LibBatIntegrationTest.java index 2591fc448..b20fc7ada 100644 --- a/java/test/org/broadinstitute/sting/jna/lsf/v7_0_6/LibBatIntegrationTest.java +++ b/java/test/org/broadinstitute/sting/jna/lsf/v7_0_6/LibBatIntegrationTest.java @@ -24,6 +24,7 @@ package org.broadinstitute.sting.jna.lsf.v7_0_6; +import com.sun.jna.ptr.IntByReference; import org.apache.commons.io.FileUtils; import org.testng.Assert; import org.testng.annotations.Test; @@ -36,15 +37,15 @@ import java.io.File; * Really a unit test, but this test will only run on systems with LSF setup. */ public class LibBatIntegrationTest extends BaseTest { - @Test(enabled=false) + @Test public void testClusterName() { String clusterName = LibLsf.ls_getclustername(); System.out.println("Cluster name: " + clusterName); Assert.assertNotNull(clusterName); } - @Test(enabled=false) - public void testSubmitEcho() { + @Test + public void testSubmitEcho() throws InterruptedException { String queue = "hour"; File outFile = new File("LibBatIntegrationTest.out"); @@ -65,14 +66,41 @@ public class LibBatIntegrationTest extends BaseTest { req.options |= LibBat.SUB_OUT_FILE; req.command = "echo \"Hello world.\""; - req.options2 |= LibBat.SUB2_BSUB_BLOCK; submitReply reply = new submitReply(); long jobId = LibBat.lsb_submit(req, reply); Assert.assertFalse(jobId < 0, LibBat.lsb_sperror("Error dispatching")); + + System.out.println("Waiting for job to run: " + jobId); + int jobStatus = LibBat.JOB_STAT_PEND; + while (isSet(jobStatus, LibBat.JOB_STAT_PEND) || isSet(jobStatus, LibBat.JOB_STAT_RUN)) { + Thread.sleep(30 * 1000L); + + int numJobs = LibBat.lsb_openjobinfo(jobId, null, null, null, null, LibBat.ALL_JOB); + try { + Assert.assertEquals(numJobs, 1); + + IntByReference more = new IntByReference(); + + jobInfoEnt jobInfo = LibBat.lsb_readjobinfo(more); + Assert.assertNotNull(jobInfo, "Job info is null"); + Assert.assertEquals(more.getValue(), 0, "More job info results than expected"); + + jobStatus = jobInfo.status; + } finally { + LibBat.lsb_closejobinfo(); + } + } + Assert.assertTrue(isSet(jobStatus, LibBat.JOB_STAT_DONE), String.format("Unexpected job status: 0x%02x", jobStatus)); + Assert.assertTrue(FileUtils.waitFor(outFile, 120), "File not found: " + outFile.getAbsolutePath()); Assert.assertTrue(outFile.delete(), "Unable to delete " + outFile.getAbsolutePath()); Assert.assertEquals(reply.queue, req.queue, "LSF reply queue does not match requested queue."); + System.out.println("Validating that we reached the end of the test without exit."); + } + + private static boolean isSet(int value, int flag) { + return ((value & flag) == flag); } }