From c3c7f17d90763e1d61cb5b3cec170be92b4543d3 Mon Sep 17 00:00:00 2001 From: Khalid Shakir Date: Tue, 29 May 2012 11:18:22 -0400 Subject: [PATCH] Updated hard limit MathUtils.MAXN number of samples from 11,000 to 50,000. Instead of creating a supposed network temporary directory locally which then fails when remote nodes try to access the non-existant dir, now checking to see if they network directory is available and throwing a SkipException to bypass the test when it cannot be run. TODO: Throw similar SkipExceptions when fastas are not available. Right now instead of skipping the test or failing fast the REQUIRE_NETWORK_CONNECTION=false means that the errors popup later when the networked fastas aren't found. --- .../broadinstitute/sting/utils/MathUtils.java | 2 +- .../org/broadinstitute/sting/BaseTest.java | 25 +++++++++++++------ .../drmaa/v1_0/JnaSessionIntegrationTest.java | 2 +- .../drmaa/v1_0/LibDrmaaIntegrationTest.java | 2 +- .../jna/lsf/v7_0_6/LibBatIntegrationTest.java | 2 +- 5 files changed, 21 insertions(+), 12 deletions(-) diff --git a/public/java/src/org/broadinstitute/sting/utils/MathUtils.java b/public/java/src/org/broadinstitute/sting/utils/MathUtils.java index 43861261c..e024253c9 100644 --- a/public/java/src/org/broadinstitute/sting/utils/MathUtils.java +++ b/public/java/src/org/broadinstitute/sting/utils/MathUtils.java @@ -55,7 +55,7 @@ public class MathUtils { private static final double JACOBIAN_LOG_TABLE_INV_STEP = 1.0 / 0.001; private static final double MAX_JACOBIAN_TOLERANCE = 8.0; private static final int JACOBIAN_LOG_TABLE_SIZE = (int) (MAX_JACOBIAN_TOLERANCE / JACOBIAN_LOG_TABLE_STEP) + 1; - private static final int MAXN = 11000; + private static final int MAXN = 50000; private static final int LOG10_CACHE_SIZE = 4 * MAXN; // we need to be able to go up to 2*(2N) when calculating some of the coefficients static { diff --git a/public/java/test/org/broadinstitute/sting/BaseTest.java b/public/java/test/org/broadinstitute/sting/BaseTest.java index 5977538c1..58f961762 100755 --- a/public/java/test/org/broadinstitute/sting/BaseTest.java +++ b/public/java/test/org/broadinstitute/sting/BaseTest.java @@ -11,6 +11,7 @@ import org.broadinstitute.sting.utils.exceptions.ReviewedStingException; import org.broadinstitute.sting.utils.io.IOUtils; import org.testng.Assert; import org.testng.Reporter; +import org.testng.SkipException; import java.io.File; import java.io.IOException; @@ -81,8 +82,10 @@ public abstract class BaseTest { public static final String hg19Chr20Intervals = intervalsLocation + "whole_exome_agilent_1.1_refseq_plus_3_boosters.Homo_sapiens_assembly19.targets.chr20.interval_list"; public static final boolean REQUIRE_NETWORK_CONNECTION = false; - public static final String networkTempDir; - public static final File networkTempDirFile; + private static final String networkTempDirRoot = "/broad/hptmp/"; + private static final boolean networkTempDirRootExists = new File(networkTempDirRoot).exists(); + private static final String networkTempDir; + private static final File networkTempDirFile; public static final File testDirFile = new File("public/testdata/"); public static final String testDir = testDirFile.getAbsolutePath() + "/"; @@ -105,19 +108,22 @@ public abstract class BaseTest { // Set the Root logger to only output warnings. logger.setLevel(Level.WARN); - if ( REQUIRE_NETWORK_CONNECTION ) { - networkTempDirFile = IOUtils.tempDir("temp.", ".dir", new File("/broad/shptmp/" + System.getProperty("user.name"))); + if (networkTempDirRootExists) { + networkTempDirFile = IOUtils.tempDir("temp.", ".dir", new File(networkTempDirRoot + System.getProperty("user.name"))); networkTempDirFile.deleteOnExit(); networkTempDir = networkTempDirFile.getAbsolutePath() + "/"; + } else { + networkTempDir = null; + networkTempDirFile = null; + } + + if ( REQUIRE_NETWORK_CONNECTION ) { // find our file sources if (!fileExist(hg18Reference) || !fileExist(hg19Reference) || !fileExist(b36KGReference)) { logger.fatal("We can't locate the reference directories. Aborting!"); throw new RuntimeException("BaseTest setup failed: unable to locate the reference directories"); } - } else { - networkTempDir = null; - networkTempDirFile = null; } } @@ -250,8 +256,11 @@ public abstract class BaseTest { * Creates a temp file that will be deleted on exit after tests are complete. * @param name Name of the file. * @return A file in the network temporary directory with name, which will be deleted after the program exits. + * @throws SkipException when the network is not available. */ - public static File createNetworkTempFile(String name) { + public static File tryCreateNetworkTempFile(String name) { + if (!networkTempDirRootExists) + throw new SkipException("Network temporary directory does not exist: " + networkTempDirRoot); File file = new File(networkTempDirFile, name); file.deleteOnExit(); return file; diff --git a/public/java/test/org/broadinstitute/sting/jna/drmaa/v1_0/JnaSessionIntegrationTest.java b/public/java/test/org/broadinstitute/sting/jna/drmaa/v1_0/JnaSessionIntegrationTest.java index f68a96d26..ea7e9746a 100644 --- a/public/java/test/org/broadinstitute/sting/jna/drmaa/v1_0/JnaSessionIntegrationTest.java +++ b/public/java/test/org/broadinstitute/sting/jna/drmaa/v1_0/JnaSessionIntegrationTest.java @@ -62,7 +62,7 @@ public class JnaSessionIntegrationTest extends BaseTest { return; } - File outFile = createNetworkTempFile("JnaSessionIntegrationTest.out"); + File outFile = tryCreateNetworkTempFile("JnaSessionIntegrationTest.out"); Session session = factory.getSession(); session.init(null); try { diff --git a/public/java/test/org/broadinstitute/sting/jna/drmaa/v1_0/LibDrmaaIntegrationTest.java b/public/java/test/org/broadinstitute/sting/jna/drmaa/v1_0/LibDrmaaIntegrationTest.java index 4c7d4ce06..db737e09a 100644 --- a/public/java/test/org/broadinstitute/sting/jna/drmaa/v1_0/LibDrmaaIntegrationTest.java +++ b/public/java/test/org/broadinstitute/sting/jna/drmaa/v1_0/LibDrmaaIntegrationTest.java @@ -101,7 +101,7 @@ public class LibDrmaaIntegrationTest extends BaseTest { Memory error = new Memory(LibDrmaa.DRMAA_ERROR_STRING_BUFFER); int errnum; - File outFile = createNetworkTempFile("LibDrmaaIntegrationTest.out"); + File outFile = tryCreateNetworkTempFile("LibDrmaaIntegrationTest.out"); errnum = LibDrmaa.drmaa_init(null, error, LibDrmaa.DRMAA_ERROR_STRING_BUFFER_LEN); diff --git a/public/java/test/org/broadinstitute/sting/jna/lsf/v7_0_6/LibBatIntegrationTest.java b/public/java/test/org/broadinstitute/sting/jna/lsf/v7_0_6/LibBatIntegrationTest.java index 21339eb46..4f31bba47 100644 --- a/public/java/test/org/broadinstitute/sting/jna/lsf/v7_0_6/LibBatIntegrationTest.java +++ b/public/java/test/org/broadinstitute/sting/jna/lsf/v7_0_6/LibBatIntegrationTest.java @@ -93,7 +93,7 @@ public class LibBatIntegrationTest extends BaseTest { @Test public void testSubmitEcho() throws Exception { String queue = "hour"; - File outFile = createNetworkTempFile("LibBatIntegrationTest.out"); + File outFile = tryCreateNetworkTempFile("LibBatIntegrationTest.out"); submit req = new submit();