use of org.apache.flink.runtime.jobmaster.JobResult in project flink by apache.
the class JobStatusPollingUtilsTest method testFailedJobResult.
@Test
public void testFailedJobResult() throws ExecutionException, InterruptedException {
final int maxAttemptCounter = 1;
final ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
try {
final ScheduledExecutor scheduledExecutor = new ScheduledExecutorServiceAdapter(executor);
final CallCountingJobStatusSupplier jobStatusSupplier = new CallCountingJobStatusSupplier(maxAttemptCounter);
final CompletableFuture<JobResult> result = JobStatusPollingUtils.pollJobResultAsync(jobStatusSupplier, () -> CompletableFuture.completedFuture(createFailedJobResult(new JobID(0, 0))), scheduledExecutor, 10);
result.join();
assertThat(jobStatusSupplier.getAttemptCounter(), is(equalTo(maxAttemptCounter)));
assertTrue(result.isDone() && result.get().getSerializedThrowable().isPresent());
} finally {
ExecutorUtils.gracefulShutdown(5, TimeUnit.SECONDS, executor);
}
}
use of org.apache.flink.runtime.jobmaster.JobResult in project flink by apache.
the class LeaderChangeClusterComponentsTest method testReelectionOfJobMaster.
@Test
public void testReelectionOfJobMaster() throws Exception {
final CompletableFuture<JobSubmissionResult> submissionFuture = miniCluster.submitJob(jobGraph);
submissionFuture.get();
CompletableFuture<JobResult> jobResultFuture = miniCluster.requestJobResult(jobId);
// need to wait until init is finished, so that the leadership revocation is possible
CommonTestUtils.waitUntilJobManagerIsInitialized(() -> miniCluster.getJobStatus(jobId).get());
highAvailabilityServices.revokeJobMasterLeadership(jobId).get();
JobResultUtils.assertIncomplete(jobResultFuture);
BlockingOperator.isBlocking = false;
highAvailabilityServices.grantJobMasterLeadership(jobId);
JobResult jobResult = jobResultFuture.get();
JobResultUtils.assertSuccess(jobResult);
}
use of org.apache.flink.runtime.jobmaster.JobResult in project flink by apache.
the class TaskExecutorITCase method testJobReExecutionAfterTaskExecutorTermination.
/**
* Tests that a job can be re-executed after the job has failed due to a TaskExecutor
* termination.
*/
@Test
public void testJobReExecutionAfterTaskExecutorTermination() throws Exception {
final JobGraph jobGraph = createJobGraph(PARALLELISM);
final CompletableFuture<JobResult> jobResultFuture = submitJobAndWaitUntilRunning(jobGraph);
// kill one TaskExecutor which should fail the job execution
miniCluster.terminateTaskManager(0);
final JobResult jobResult = jobResultFuture.get();
assertThat(jobResult.isSuccess(), is(false));
miniCluster.startTaskManager();
final JobGraph newJobGraph = createJobGraph(PARALLELISM);
BlockingOperator.unblock();
miniCluster.submitJob(newJobGraph).get();
miniCluster.requestJobResult(newJobGraph.getJobID()).get();
}
use of org.apache.flink.runtime.jobmaster.JobResult in project flink by apache.
the class TaskExecutorITCase method testJobRecoveryWithFailingTaskExecutor.
/**
* Tests that the job can recover from a failing {@link TaskExecutor}.
*/
@Test
public void testJobRecoveryWithFailingTaskExecutor() throws Exception {
final JobGraph jobGraph = createJobGraphWithRestartStrategy(PARALLELISM);
final CompletableFuture<JobResult> jobResultFuture = submitJobAndWaitUntilRunning(jobGraph);
// start an additional TaskExecutor
miniCluster.startTaskManager();
// this should fail the job
miniCluster.terminateTaskManager(0).get();
BlockingOperator.unblock();
assertThat(jobResultFuture.get().isSuccess(), is(true));
}
use of org.apache.flink.runtime.jobmaster.JobResult in project flink by apache.
the class NetworkStackThroughputITCase method testProgram.
private void testProgram(final MiniClusterWithClientResource cluster, final int dataVolumeGb, final boolean useForwarder, final boolean isSlowSender, final boolean isSlowReceiver, final int parallelism) throws Exception {
final ClusterClient<?> client = cluster.getClusterClient();
final JobGraph jobGraph = createJobGraph(dataVolumeGb, useForwarder, isSlowSender, isSlowReceiver, parallelism);
final JobResult jobResult = client.submitJob(jobGraph).thenCompose(client::requestJobResult).get();
Assert.assertFalse(jobResult.getSerializedThrowable().isPresent());
final long dataVolumeMbit = dataVolumeGb * 8192;
final long runtimeSecs = TimeUnit.SECONDS.convert(jobResult.getNetRuntime(), TimeUnit.MILLISECONDS);
final int mbitPerSecond = (int) (((double) dataVolumeMbit) / runtimeSecs);
LOG.info(String.format("Test finished with throughput of %d MBit/s (runtime [secs]: %d, " + "data volume [gb/mbits]: %d/%d)", mbitPerSecond, runtimeSecs, dataVolumeGb, dataVolumeMbit));
}
Aggregations