Search in sources :

Example 6 with PipelineState

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

the class VmExecutionLogSummary method ofFailedStages.

public static void ofFailedStages(final Storage storage, final PipelineState state) {
    List<StageOutput> failures = state.stageOutputs().stream().filter(stageOutput -> stageOutput.status().equals(PipelineStatus.FAILED)).collect(Collectors.toList());
    if (!failures.isEmpty()) {
        LOGGER.error("Failures in pipeline stages. Printing each failures full run.log here");
        for (StageOutput failure : failures) {
            for (Blob log : failure.failedLogLocations().stream().map(GoogleStorageLocation::asBlobId).map(storage::get).collect(Collectors.toList())) {
                LOGGER.error("========================================== start {} ==========================================", log.getName());
                LOGGER.error(new String(log.getContent()));
                LOGGER.error("========================================== end {} ==========================================", log.getName());
            }
        }
    }
}
Also used : StageOutput(com.hartwig.pipeline.StageOutput) Blob(com.google.cloud.storage.Blob) List(java.util.List) GoogleStorageLocation(com.hartwig.pipeline.storage.GoogleStorageLocation) Logger(org.slf4j.Logger) PipelineState(com.hartwig.pipeline.PipelineState) LoggerFactory(org.slf4j.LoggerFactory) PipelineStatus(com.hartwig.pipeline.execution.PipelineStatus) Storage(com.google.cloud.storage.Storage) StageOutput(com.hartwig.pipeline.StageOutput) Collectors(java.util.stream.Collectors) Blob(com.google.cloud.storage.Blob) GoogleStorageLocation(com.hartwig.pipeline.storage.GoogleStorageLocation)

Example 7 with PipelineState

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

the class LocalSomaticMetadataTest method publishesEventIfSpecifiedInArguments.

@Test
public void publishesEventIfSpecifiedInArguments() {
    PipelineState state = mock(PipelineState.class);
    SomaticRunMetadata metadata = mock(SomaticRunMetadata.class);
    new LocalSomaticMetadata(Arguments.testDefaultsBuilder().setId(setId).publishDbLoadEvent(true).build(), jsonSampleSource, stagedOutputPublisher).complete(state, metadata);
    verify(stagedOutputPublisher).publish(state, metadata);
}
Also used : PipelineState(com.hartwig.pipeline.PipelineState) Test(org.junit.Test)

Example 8 with PipelineState

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

the class ResearchMetadataApiTest method setsStatusAndEndTimeOnComplete.

@Test
public void setsStatusAndEndTimeOnComplete() {
    ArgumentCaptor<Long> runIdArgumentCaptor = ArgumentCaptor.forClass(Long.class);
    ArgumentCaptor<UpdateRun> updateRunArgumentCaptor = ArgumentCaptor.forClass(UpdateRun.class);
    when(runApi.update(runIdArgumentCaptor.capture(), updateRunArgumentCaptor.capture())).thenReturn(run);
    PipelineState state = new PipelineState();
    state.add(TestOutput.builder().status(PipelineStatus.FAILED).build());
    victim.complete(state, TestInputs.defaultSomaticRunMetadata());
    assertThat(runIdArgumentCaptor.getValue()).isEqualTo(RUN_ID);
    UpdateRun updateRun = updateRunArgumentCaptor.getValue();
    assertThat(updateRun.getEndTime()).isNotNull();
    assertThat(updateRun.getStatus()).isEqualTo(Status.FAILED);
}
Also used : PipelineState(com.hartwig.pipeline.PipelineState) UpdateRun(com.hartwig.api.model.UpdateRun) Test(org.junit.Test)

Example 9 with PipelineState

use of com.hartwig.pipeline.PipelineState 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

PipelineState (com.hartwig.pipeline.PipelineState)9 Test (org.junit.Test)4 Blob (com.google.cloud.storage.Blob)3 Storage (com.google.cloud.storage.Storage)3 SampleSet (com.hartwig.api.model.SampleSet)2 AnalysisOutputBlob (com.hartwig.events.AnalysisOutputBlob)2 Arguments (com.hartwig.pipeline.Arguments)2 ImmutableArguments (com.hartwig.pipeline.ImmutableArguments)2 PipelineMain (com.hartwig.pipeline.PipelineMain)2 StageOutput (com.hartwig.pipeline.StageOutput)2 PipelineStatus (com.hartwig.pipeline.execution.PipelineStatus)2 File (java.io.File)2 NotNull (org.jetbrains.annotations.NotNull)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ApiFuture (com.google.api.core.ApiFuture)1 Publisher (com.google.cloud.pubsub.v1.Publisher)1 Bucket (com.google.cloud.storage.Bucket)1 PubsubMessage (com.google.pubsub.v1.PubsubMessage)1 Run (com.hartwig.api.model.Run)1 UpdateRun (com.hartwig.api.model.UpdateRun)1