use of org.apache.flink.runtime.jobmaster.JobResult in project flink by apache.
the class PipelinedRegionSchedulingITCase method testRecoverFromPartitionException.
@Test(timeout = 120000)
public void testRecoverFromPartitionException() throws Exception {
final Configuration configuration = new Configuration();
configuration.setString(RestartStrategyOptions.RESTART_STRATEGY, "fixed-delay");
configuration.set(RestartStrategyOptions.RESTART_STRATEGY_FIXED_DELAY_ATTEMPTS, 1);
OneTimeFailingReceiverWithPartitionException.hasFailed.set(false);
final JobResult jobResult = executeSchedulingTest(createJobGraphWithThreeStages(2), 2, configuration);
assertThat(jobResult.getSerializedThrowable().isPresent(), is(false));
}
use of org.apache.flink.runtime.jobmaster.JobResult in project flink by apache.
the class PipelinedRegionSchedulingITCase method testFailsOnInsufficientSlots.
@Test
public void testFailsOnInsufficientSlots() throws Exception {
final JobResult jobResult = executeSchedulingTest(1);
assertThat(jobResult.getSerializedThrowable().isPresent(), is(true));
final Throwable jobFailure = jobResult.getSerializedThrowable().get().deserializeError(ClassLoader.getSystemClassLoader());
final Optional<NoResourceAvailableException> cause = ExceptionUtils.findThrowable(jobFailure, NoResourceAvailableException.class);
assertThat(cause.isPresent(), is(true));
assertThat(cause.get().getMessage(), containsString("Slot request bulk is not fulfillable!"));
}
use of org.apache.flink.runtime.jobmaster.JobResult in project flink by apache.
the class JobResultStoreContractTest method testGetDirtyResultsWithDirtyAndCleanEntry.
@Test
default void testGetDirtyResultsWithDirtyAndCleanEntry() throws IOException {
JobResultStore jobResultStore = createJobResultStore();
jobResultStore.createDirtyResult(DUMMY_JOB_RESULT_ENTRY);
jobResultStore.markResultAsClean(DUMMY_JOB_RESULT_ENTRY.getJobId());
final JobResultEntry otherDirtyJobResultEntry = new JobResultEntry(TestingJobResultStore.createSuccessfulJobResult(new JobID()));
jobResultStore.createDirtyResult(otherDirtyJobResultEntry);
assertThat(jobResultStore.getDirtyResults().stream().map(JobResult::getJobId).collect(Collectors.toList())).singleElement().isEqualTo(otherDirtyJobResultEntry.getJobId());
}
use of org.apache.flink.runtime.jobmaster.JobResult in project flink by apache.
the class MiniClusterITCase method testOutOfMemoryErrorMessageEnrichmentInJobVertexFinalization.
@Test
public void testOutOfMemoryErrorMessageEnrichmentInJobVertexFinalization() throws Exception {
final int parallelism = 1;
final MiniClusterConfiguration cfg = new MiniClusterConfiguration.Builder().setNumTaskManagers(1).setNumSlotsPerTaskManager(parallelism).setConfiguration(getDefaultConfiguration()).build();
try (final MiniCluster miniCluster = new MiniCluster(cfg)) {
miniCluster.start();
final JobVertex failingJobVertex = new OutOfMemoryInFinalizationJobVertex();
failingJobVertex.setInvokableClass(NoOpInvokable.class);
failingJobVertex.setParallelism(parallelism);
final JobGraph jobGraph = JobGraphTestUtils.streamingJobGraph(failingJobVertex);
final CompletableFuture<JobSubmissionResult> submissionFuture = miniCluster.submitJob(jobGraph);
final CompletableFuture<JobResult> jobResultFuture = submissionFuture.thenCompose((JobSubmissionResult ignored) -> miniCluster.requestJobResult(jobGraph.getJobID()));
try {
jobResultFuture.get().toJobExecutionResult(getClass().getClassLoader());
} catch (JobExecutionException e) {
assertThat(e, FlinkMatchers.containsCause(OutOfMemoryError.class));
assertThat(findThrowable(e, OutOfMemoryError.class).map(OutOfMemoryError::getMessage).get(), startsWith("Java heap space. A heap space-related out-of-memory error has occurred."));
}
}
}
use of org.apache.flink.runtime.jobmaster.JobResult in project flink by apache.
the class JobExecutionResultResponseBodyTest method assertOriginalEqualsToUnmarshalled.
@Override
protected void assertOriginalEqualsToUnmarshalled(final JobExecutionResultResponseBody expected, final JobExecutionResultResponseBody actual) {
assertThat(actual.getStatus(), equalTo(actual.getStatus()));
final JobResult expectedJobExecutionResult = expected.getJobExecutionResult();
final JobResult actualJobExecutionResult = actual.getJobExecutionResult();
if (expectedJobExecutionResult != null) {
assertNotNull(actualJobExecutionResult);
assertThat(actualJobExecutionResult.getJobId(), equalTo(expectedJobExecutionResult.getJobId()));
assertThat(actualJobExecutionResult.getApplicationStatus(), equalTo(expectedJobExecutionResult.getApplicationStatus()));
assertThat(actualJobExecutionResult.getNetRuntime(), equalTo(expectedJobExecutionResult.getNetRuntime()));
assertThat(actualJobExecutionResult.getAccumulatorResults(), equalTo(expectedJobExecutionResult.getAccumulatorResults()));
final Optional<SerializedThrowable> expectedFailureCauseOptional = expectedJobExecutionResult.getSerializedThrowable();
expectedFailureCauseOptional.ifPresent(expectedFailureCause -> {
final SerializedThrowable actualFailureCause = actualJobExecutionResult.getSerializedThrowable().orElseThrow(() -> new AssertionError("actualFailureCause is not available"));
assertThat(actualFailureCause.getFullStringifiedStackTrace(), equalTo(expectedFailureCause.getFullStringifiedStackTrace()));
assertThat(actualFailureCause.getOriginalErrorClassName(), equalTo(expectedFailureCause.getOriginalErrorClassName()));
assertArrayEquals(expectedFailureCause.getSerializedException(), actualFailureCause.getSerializedException());
});
if (expectedJobExecutionResult.getAccumulatorResults() != null) {
assertNotNull(actualJobExecutionResult.getAccumulatorResults());
assertArrayEquals(actualJobExecutionResult.getAccumulatorResults().get(TEST_ACCUMULATOR_NAME).getByteArray(), expectedJobExecutionResult.getAccumulatorResults().get(TEST_ACCUMULATOR_NAME).getByteArray());
}
}
}
Aggregations