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());
}
}
}
}
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);
}
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);
}
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);
}
Aggregations