Search in sources :

Example 61 with JobStatus

use of org.apache.flink.api.common.JobStatus in project flink by apache.

the class AbstractOperatorRestoreTestBase method restoreJob.

private void restoreJob(ClusterClient<?> clusterClient, Deadline deadline, String savepointPath) throws Exception {
    JobGraph jobToRestore = createJobGraph(ExecutionMode.RESTORE);
    jobToRestore.setSavepointRestoreSettings(SavepointRestoreSettings.forPath(savepointPath, allowNonRestoredState));
    assertNotNull("Job doesn't have a JobID.", jobToRestore.getJobID());
    clusterClient.submitJob(jobToRestore).get();
    CompletableFuture<JobStatus> jobStatusFuture = FutureUtils.retrySuccessfulWithDelay(() -> clusterClient.getJobStatus(jobToRestore.getJobID()), Time.milliseconds(50), deadline, (jobStatus) -> jobStatus == JobStatus.FINISHED, TestingUtils.defaultScheduledExecutor());
    assertEquals(JobStatus.FINISHED, jobStatusFuture.get(deadline.timeLeft().toMillis(), TimeUnit.MILLISECONDS));
}
Also used : JobStatus(org.apache.flink.api.common.JobStatus) JobGraph(org.apache.flink.runtime.jobgraph.JobGraph)

Example 62 with JobStatus

use of org.apache.flink.api.common.JobStatus in project flink by apache.

the class CheckpointStoreITCase method testJobClientRemainsResponsiveDuringCompletedCheckpointStoreRecovery.

@Test
public void testJobClientRemainsResponsiveDuringCompletedCheckpointStoreRecovery() throws Exception {
    final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
    env.enableCheckpointing(10);
    env.setRestartStrategy(fixedDelayRestart(2, /* failure on processing + on recovery */
    0));
    env.addSource(emitUntil(() -> FailingMapper.failedAndProcessed)).map(new FailingMapper()).addSink(new DiscardingSink<>());
    final JobClient jobClient = env.executeAsync();
    BlockingHighAvailabilityServiceFactory.fetchRemoteCheckpointsStart.await();
    for (int i = 0; i < 10; i++) {
        final JobStatus jobStatus = jobClient.getJobStatus().get();
        assertEquals(JobStatus.INITIALIZING, jobStatus);
    }
    BlockingHighAvailabilityServiceFactory.fetchRemoteCheckpointsFinished.countDown();
    // Await for job to finish.
    jobClient.getJobExecutionResult().get();
    checkState(FailingMapper.failedAndProcessed);
}
Also used : JobStatus(org.apache.flink.api.common.JobStatus) StreamExecutionEnvironment(org.apache.flink.streaming.api.environment.StreamExecutionEnvironment) JobClient(org.apache.flink.core.execution.JobClient) Test(org.junit.Test)

Aggregations

JobStatus (org.apache.flink.api.common.JobStatus)62 Test (org.junit.Test)28 JobID (org.apache.flink.api.common.JobID)19 CompletableFuture (java.util.concurrent.CompletableFuture)15 JobGraph (org.apache.flink.runtime.jobgraph.JobGraph)14 FlinkException (org.apache.flink.util.FlinkException)8 ExecutionException (java.util.concurrent.ExecutionException)7 IOException (java.io.IOException)6 ArrayList (java.util.ArrayList)6 Time (org.apache.flink.api.common.time.Time)6 ExecutionGraphInfo (org.apache.flink.runtime.scheduler.ExecutionGraphInfo)6 TaskExecutionState (org.apache.flink.runtime.taskmanager.TaskExecutionState)6 Collections (java.util.Collections)5 HashMap (java.util.HashMap)5 ExecutionState (org.apache.flink.runtime.execution.ExecutionState)5 FutureUtils (org.apache.flink.util.concurrent.FutureUtils)5 TimeUnit (java.util.concurrent.TimeUnit)4 Configuration (org.apache.flink.configuration.Configuration)4 ExecutionAttemptID (org.apache.flink.runtime.executiongraph.ExecutionAttemptID)4 Acknowledge (org.apache.flink.runtime.messages.Acknowledge)4