Search in sources :

Example 36 with JobResult

use of org.apache.flink.runtime.jobmaster.JobResult in project flink by apache.

the class LeaderChangeClusterComponentsTest method testReelectionOfDispatcher.

@Test
public void testReelectionOfDispatcher() throws Exception {
    final CompletableFuture<JobSubmissionResult> submissionFuture = miniCluster.submitJob(jobGraph);
    submissionFuture.get();
    CompletableFuture<JobResult> jobResultFuture = miniCluster.requestJobResult(jobId);
    highAvailabilityServices.revokeDispatcherLeadership().get();
    JobResult jobResult = jobResultFuture.get();
    assertEquals(jobResult.getApplicationStatus(), ApplicationStatus.UNKNOWN);
    highAvailabilityServices.grantDispatcherLeadership();
    BlockingOperator.isBlocking = false;
    final CompletableFuture<JobSubmissionResult> submissionFuture2 = miniCluster.submitJob(jobGraph);
    submissionFuture2.get();
    final CompletableFuture<JobResult> jobResultFuture2 = miniCluster.requestJobResult(jobId);
    jobResult = jobResultFuture2.get();
    JobResultUtils.assertSuccess(jobResult);
}
Also used : JobSubmissionResult(org.apache.flink.api.common.JobSubmissionResult) JobResult(org.apache.flink.runtime.jobmaster.JobResult) Test(org.junit.Test)

Example 37 with JobResult

use of org.apache.flink.runtime.jobmaster.JobResult in project flink by apache.

the class CheckpointResourcesCleanupRunnerTest method testRequestJobWithFailure.

@Test
public void testRequestJobWithFailure() {
    final SerializedThrowable expectedError = new SerializedThrowable(new Exception("Expected exception"));
    final JobResult jobResult = createJobResultWithFailure(expectedError);
    testRequestJobExecutionGraph(jobResult, System.currentTimeMillis(), actualExecutionGraph -> Objects.requireNonNull(actualExecutionGraph.getFailureInfo()).getException().equals(expectedError));
}
Also used : JobResult(org.apache.flink.runtime.jobmaster.JobResult) FlinkException(org.apache.flink.util.FlinkException) ExecutionException(java.util.concurrent.ExecutionException) UnavailableDispatcherOperationException(org.apache.flink.runtime.dispatcher.UnavailableDispatcherOperationException) SerializedThrowable(org.apache.flink.util.SerializedThrowable) Test(org.junit.jupiter.api.Test)

Example 38 with JobResult

use of org.apache.flink.runtime.jobmaster.JobResult in project flink by apache.

the class CheckpointResourcesCleanupRunnerTest method testRequestJob_JobId.

@Test
public void testRequestJob_JobId() {
    final JobResult jobResult = createDummySuccessJobResult();
    testRequestJobExecutionGraph(jobResult, System.currentTimeMillis(), actualExecutionGraph -> actualExecutionGraph.getJobID().equals(jobResult.getJobId()));
}
Also used : JobResult(org.apache.flink.runtime.jobmaster.JobResult) Test(org.junit.jupiter.api.Test)

Example 39 with JobResult

use of org.apache.flink.runtime.jobmaster.JobResult in project flink by apache.

the class SessionDispatcherLeaderProcessTest method testRecoveryWithMultipleJobGraphsAndOneMatchingDirtyJobResult.

@Test
public void testRecoveryWithMultipleJobGraphsAndOneMatchingDirtyJobResult() throws Exception {
    final JobResult matchingDirtyJobResult = TestingJobResultStore.createSuccessfulJobResult(JOB_GRAPH.getJobID());
    final JobGraph otherJobGraph = JobGraphTestUtils.emptyJobGraph();
    testJobRecovery(Arrays.asList(otherJobGraph, JOB_GRAPH), Collections.singleton(matchingDirtyJobResult), actualRecoveredJobGraphs -> assertThat(actualRecoveredJobGraphs).singleElement().isEqualTo(otherJobGraph), actualRecoveredDirtyJobResults -> assertThat(actualRecoveredDirtyJobResults).singleElement().isEqualTo(matchingDirtyJobResult));
}
Also used : JobGraph(org.apache.flink.runtime.jobgraph.JobGraph) JobResult(org.apache.flink.runtime.jobmaster.JobResult) Test(org.junit.jupiter.api.Test)

Example 40 with JobResult

use of org.apache.flink.runtime.jobmaster.JobResult in project flink by apache.

the class SessionDispatcherLeaderProcessTest method testRecoveryWithJobGraphAndMatchingDirtyJobResult.

@Test
public void testRecoveryWithJobGraphAndMatchingDirtyJobResult() throws Exception {
    final JobResult matchingDirtyJobResult = TestingJobResultStore.createSuccessfulJobResult(JOB_GRAPH.getJobID());
    testJobRecovery(Collections.singleton(JOB_GRAPH), Collections.singleton(matchingDirtyJobResult), actualRecoveredJobGraphs -> assertThat(actualRecoveredJobGraphs).isEmpty(), actualRecoveredDirtyJobResults -> assertThat(actualRecoveredDirtyJobResults).singleElement().isEqualTo(matchingDirtyJobResult));
}
Also used : JobResult(org.apache.flink.runtime.jobmaster.JobResult) Test(org.junit.jupiter.api.Test)

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