Search in sources :

Example 16 with JobResult

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));
}
Also used : MiniClusterConfiguration(org.apache.flink.runtime.minicluster.MiniClusterConfiguration) Configuration(org.apache.flink.configuration.Configuration) JobResult(org.apache.flink.runtime.jobmaster.JobResult) Test(org.junit.Test)

Example 17 with JobResult

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!"));
}
Also used : JobResult(org.apache.flink.runtime.jobmaster.JobResult) NoResourceAvailableException(org.apache.flink.runtime.jobmanager.scheduler.NoResourceAvailableException) Test(org.junit.Test)

Example 18 with JobResult

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());
}
Also used : JobResult(org.apache.flink.runtime.jobmaster.JobResult) TestingJobResultStore(org.apache.flink.runtime.testutils.TestingJobResultStore) JobID(org.apache.flink.api.common.JobID) Test(org.junit.jupiter.api.Test)

Example 19 with JobResult

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."));
        }
    }
}
Also used : JobSubmissionResult(org.apache.flink.api.common.JobSubmissionResult) JobGraph(org.apache.flink.runtime.jobgraph.JobGraph) JobVertex(org.apache.flink.runtime.jobgraph.JobVertex) JobExecutionException(org.apache.flink.runtime.client.JobExecutionException) JobResult(org.apache.flink.runtime.jobmaster.JobResult) Test(org.junit.Test)

Example 20 with JobResult

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());
        }
    }
}
Also used : JobResult(org.apache.flink.runtime.jobmaster.JobResult) SerializedThrowable(org.apache.flink.util.SerializedThrowable)

Aggregations

JobResult (org.apache.flink.runtime.jobmaster.JobResult)58 Test (org.junit.Test)28 JobGraph (org.apache.flink.runtime.jobgraph.JobGraph)25 JobID (org.apache.flink.api.common.JobID)15 Test (org.junit.jupiter.api.Test)13 MiniCluster (org.apache.flink.runtime.minicluster.MiniCluster)11 ExecutionException (java.util.concurrent.ExecutionException)8 JobSubmissionResult (org.apache.flink.api.common.JobSubmissionResult)7 Deadline (org.apache.flink.api.common.time.Deadline)7 Configuration (org.apache.flink.configuration.Configuration)7 File (java.io.File)5 JobResultStore (org.apache.flink.runtime.highavailability.JobResultStore)5 IOException (java.io.IOException)4 CompletableFuture (java.util.concurrent.CompletableFuture)4 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)4 JobVertex (org.apache.flink.runtime.jobgraph.JobVertex)4 Duration (java.time.Duration)3 List (java.util.List)3 Time (org.apache.flink.api.common.time.Time)3 MiniClusterClient (org.apache.flink.client.program.MiniClusterClient)3