Search in sources :

Example 1 with PipelineMain

use of com.hartwig.pipeline.PipelineMain in project pipeline5 by hartwigmedical.

the class SmokeTest method runFullPipelineAndCheckFinalStatus.

public void runFullPipelineAndCheckFinalStatus(final String inputMode, final PipelineStatus expectedStatus) throws Exception {
    PipelineMain victim = new PipelineMain();
    String version = version();
    String setName = noDots(inputMode + "-" + version);
    final String fixtureDir = "smoke_test/" + inputMode + "/";
    final String randomRunId = noDots(RandomStringUtils.random(5, true, false));
    final ImmutableArguments.Builder builder = Arguments.defaultsBuilder(Arguments.DefaultsProfile.DEVELOPMENT.toString()).sampleJson(Resources.testResource(fixtureDir + "samples.json")).cloudSdkPath(CLOUD_SDK_PATH).setId(setName).runId(randomRunId).runGermlineCaller(false).cleanup(true).outputBucket("smoketest-pipeline-output-pilot-1").context(Context.DIAGNOSTIC);
    final String username = System.getProperty("user.name");
    if (username.equals("root")) {
        String privateKeyPath = workingDir() + "/google-key.json";
        builder.privateKeyPath(privateKeyPath).uploadPrivateKeyPath(privateKeyPath);
    } else {
        builder.cloudSdkPath(String.format("/Users/%s/google-cloud-sdk/bin", username));
    }
    Arguments arguments = builder.build();
    Storage storage = StorageProvider.from(arguments, CredentialProvider.from(arguments).get()).get();
    cleanupBucket(inputMode, arguments.outputBucket(), storage);
    PipelineState state = victim.start(arguments);
    assertThat(state.status()).isEqualTo(expectedStatus);
    File expectedFilesResource = new File(Resources.testResource(fixtureDir + "expected_output_files"));
    List<String> expectedFiles = FileUtils.readLines(expectedFilesResource, FILE_ENCODING);
    final String outputDir = setName + "-" + randomRunId;
    List<String> actualFiles = listOutput(outputDir, arguments.outputBucket(), storage);
    assertThat(actualFiles).containsOnlyElementsOf(expectedFiles);
    cleanupBucket(outputDir, arguments.outputBucket(), storage);
}
Also used : PipelineState(com.hartwig.pipeline.PipelineState) PipelineMain(com.hartwig.pipeline.PipelineMain) Storage(com.google.cloud.storage.Storage) Arguments(com.hartwig.pipeline.Arguments) ImmutableArguments(com.hartwig.pipeline.ImmutableArguments) ImmutableArguments(com.hartwig.pipeline.ImmutableArguments) File(java.io.File)

Example 2 with PipelineMain

use of com.hartwig.pipeline.PipelineMain in project pipeline5 by hartwigmedical.

the class SmokeTest method runFullPipelineAndCheckFinalStatus.

public void runFullPipelineAndCheckFinalStatus(final String inputMode, final PipelineStatus expectedStatus, @SuppressWarnings("OptionalUsedAsFieldOrParameterType") final Optional<String> targetedRegionsBed, final RefGenomeVersion refGenomeVersion) throws Exception {
    final PipelineMain victim = new PipelineMain();
    final String version = version();
    final String setName = noDots(inputMode + "-" + version);
    final String fixtureDir = "smoke_test/" + inputMode + "/";
    @SuppressWarnings("deprecation") final String randomRunId = noDots(RandomStringUtils.random(5, true, false));
    final ImmutableArguments.Builder builder = Arguments.defaultsBuilder(Arguments.DefaultsProfile.DEVELOPMENT.toString()).sampleJson(Resources.testResource(fixtureDir + "samples.json")).cloudSdkPath(findCloudSdk()).setId(setName).runId(randomRunId).runGermlineCaller(false).cleanup(false).outputBucket("smoketest-pipeline-output-pilot-1").context(Context.DIAGNOSTIC).useTargetRegions(false).refGenomeVersion(refGenomeVersion);
    if (whoami.equals("root")) {
        String privateKeyPath = workingDir() + "/google-key.json";
        builder.privateKeyPath(privateKeyPath).uploadPrivateKeyPath(privateKeyPath);
    }
    Arguments arguments = builder.build();
    Storage storage = StorageProvider.from(arguments, CredentialProvider.from(arguments).get()).get();
    cleanupBucket(inputMode, arguments.outputBucket(), storage);
    PipelineState state = victim.start(arguments);
    assertThat(state.status()).isEqualTo(expectedStatus);
    File expectedFilesResource = new File(Resources.testResource(fixtureDir + "expected_output_files"));
    List<String> expectedFiles = FileUtils.readLines(expectedFilesResource, FILE_ENCODING);
    final String outputDir = setName + "-" + randomRunId;
    List<String> actualFiles = listOutput(outputDir, arguments.outputBucket(), storage);
    assertThat(actualFiles).containsOnlyElementsOf(expectedFiles);
    if (inputMode.equals("tumor-reference")) {
        ComparAssert.assertThat(storage, arguments.outputBucket(), outputDir).isEqualToTruthset(Resources.testResource(fixtureDir + "/truthset")).cleanup();
    }
    cleanupBucket(outputDir, arguments.outputBucket(), storage);
}
Also used : PipelineState(com.hartwig.pipeline.PipelineState) PipelineMain(com.hartwig.pipeline.PipelineMain) Storage(com.google.cloud.storage.Storage) Arguments(com.hartwig.pipeline.Arguments) ImmutableArguments(com.hartwig.pipeline.ImmutableArguments) ImmutableArguments(com.hartwig.pipeline.ImmutableArguments) File(java.io.File)

Aggregations

Storage (com.google.cloud.storage.Storage)2 Arguments (com.hartwig.pipeline.Arguments)2 ImmutableArguments (com.hartwig.pipeline.ImmutableArguments)2 PipelineMain (com.hartwig.pipeline.PipelineMain)2 PipelineState (com.hartwig.pipeline.PipelineState)2 File (java.io.File)2