use of org.apache.flink.runtime.taskexecutor.ExecutionDeploymentReport in project flink by apache.
the class JobMasterExecutionDeploymentReconciliationTest method testExecutionDeploymentReconciliation.
/**
* Tests how the job master handles unknown/missing executions.
*/
@Test
public void testExecutionDeploymentReconciliation() throws Exception {
JobMasterBuilder.TestingOnCompletionActions onCompletionActions = new JobMasterBuilder.TestingOnCompletionActions();
TestingExecutionDeploymentTrackerWrapper deploymentTrackerWrapper = new TestingExecutionDeploymentTrackerWrapper();
final JobGraph jobGraph = JobGraphTestUtils.singleNoOpJobGraph();
JobMaster jobMaster = createAndStartJobMaster(onCompletionActions, deploymentTrackerWrapper, jobGraph);
JobMasterGateway jobMasterGateway = jobMaster.getSelfGateway(JobMasterGateway.class);
RPC_SERVICE_RESOURCE.getTestingRpcService().registerGateway(jobMasterGateway.getAddress(), jobMasterGateway);
final CompletableFuture<ExecutionAttemptID> taskCancellationFuture = new CompletableFuture<>();
TaskExecutorGateway taskExecutorGateway = createTaskExecutorGateway(taskCancellationFuture);
LocalUnresolvedTaskManagerLocation localUnresolvedTaskManagerLocation = new LocalUnresolvedTaskManagerLocation();
registerTaskExecutorAndOfferSlots(jobMasterGateway, jobGraph.getJobID(), taskExecutorGateway, localUnresolvedTaskManagerLocation);
ExecutionAttemptID deployedExecution = deploymentTrackerWrapper.getTaskDeploymentFuture().get();
assertFalse(taskCancellationFuture.isDone());
ExecutionAttemptID unknownDeployment = new ExecutionAttemptID();
// the deployment report is missing the just deployed task, but contains the ID of some
// other unknown deployment
// the job master should cancel the unknown deployment, and fail the job
jobMasterGateway.heartbeatFromTaskManager(localUnresolvedTaskManagerLocation.getResourceID(), new TaskExecutorToJobManagerHeartbeatPayload(new AccumulatorReport(Collections.emptyList()), new ExecutionDeploymentReport(Collections.singleton(unknownDeployment))));
assertThat(taskCancellationFuture.get(), is(unknownDeployment));
assertThat(deploymentTrackerWrapper.getStopFuture().get(), is(deployedExecution));
assertThat(onCompletionActions.getJobReachedGloballyTerminalStateFuture().get().getArchivedExecutionGraph().getState(), is(JobStatus.FAILED));
}
use of org.apache.flink.runtime.taskexecutor.ExecutionDeploymentReport in project flink by apache.
the class DefaultExecutionDeploymentReconcilerTest method testUnknownDeployments.
@Test
public void testUnknownDeployments() {
TestingExecutionDeploymentReconciliationHandler handler = new TestingExecutionDeploymentReconciliationHandler();
DefaultExecutionDeploymentReconciler reconciler = new DefaultExecutionDeploymentReconciler(handler);
ResourceID resourceId = generate();
ExecutionAttemptID attemptId = new ExecutionAttemptID();
reconciler.reconcileExecutionDeployments(resourceId, new ExecutionDeploymentReport(Collections.singleton(attemptId)), Collections.emptyMap());
assertThat(handler.getMissingExecutions(), empty());
assertThat(handler.getUnknownExecutions(), hasItem(attemptId));
}
use of org.apache.flink.runtime.taskexecutor.ExecutionDeploymentReport in project flink by apache.
the class DefaultExecutionDeploymentReconcilerTest method testMissingAndUnknownDeployments.
@Test
public void testMissingAndUnknownDeployments() {
TestingExecutionDeploymentReconciliationHandler handler = new TestingExecutionDeploymentReconciliationHandler();
DefaultExecutionDeploymentReconciler reconciler = new DefaultExecutionDeploymentReconciler(handler);
ResourceID resourceId = generate();
ExecutionAttemptID unknownId = new ExecutionAttemptID();
ExecutionAttemptID missingId = new ExecutionAttemptID();
ExecutionAttemptID matchingId = new ExecutionAttemptID();
reconciler.reconcileExecutionDeployments(resourceId, new ExecutionDeploymentReport(new HashSet<>(Arrays.asList(unknownId, matchingId))), Stream.of(missingId, matchingId).collect(Collectors.toMap(x -> x, x -> ExecutionDeploymentState.DEPLOYED)));
assertThat(handler.getMissingExecutions(), hasItem(missingId));
assertThat(handler.getUnknownExecutions(), hasItem(unknownId));
}
use of org.apache.flink.runtime.taskexecutor.ExecutionDeploymentReport in project flink by apache.
the class DefaultExecutionDeploymentReconcilerTest method testPendingDeployments.
@Test
public void testPendingDeployments() {
TestingExecutionDeploymentReconciliationHandler handler = new TestingExecutionDeploymentReconciliationHandler();
DefaultExecutionDeploymentReconciler reconciler = new DefaultExecutionDeploymentReconciler(handler);
ResourceID resourceId = generate();
ExecutionAttemptID matchingId = new ExecutionAttemptID();
ExecutionAttemptID unknownId = new ExecutionAttemptID();
ExecutionAttemptID missingId = new ExecutionAttemptID();
reconciler.reconcileExecutionDeployments(resourceId, new ExecutionDeploymentReport(new HashSet<>(Arrays.asList(matchingId, unknownId))), Stream.of(matchingId, missingId).collect(Collectors.toMap(x -> x, x -> ExecutionDeploymentState.PENDING)));
assertThat(handler.getMissingExecutions(), empty());
assertThat(handler.getUnknownExecutions(), hasItem(unknownId));
}
use of org.apache.flink.runtime.taskexecutor.ExecutionDeploymentReport in project flink by apache.
the class JobMasterExecutionDeploymentReconciliationTest method testExecutionDeploymentReconciliationForPendingExecution.
/**
* Tests that the job master does not issue a cancel call if the heartbeat reports an execution
* for which the deployment was not yet acknowledged.
*/
@Test
public void testExecutionDeploymentReconciliationForPendingExecution() throws Exception {
TestingExecutionDeploymentTrackerWrapper deploymentTrackerWrapper = new TestingExecutionDeploymentTrackerWrapper();
final JobGraph jobGraph = JobGraphTestUtils.singleNoOpJobGraph();
JobMaster jobMaster = createAndStartJobMaster(deploymentTrackerWrapper, jobGraph);
JobMasterGateway jobMasterGateway = jobMaster.getSelfGateway(JobMasterGateway.class);
RPC_SERVICE_RESOURCE.getTestingRpcService().registerGateway(jobMasterGateway.getAddress(), jobMasterGateway);
final CompletableFuture<ExecutionAttemptID> taskSubmissionFuture = new CompletableFuture<>();
final CompletableFuture<ExecutionAttemptID> taskCancellationFuture = new CompletableFuture<>();
final CompletableFuture<Acknowledge> taskSubmissionAcknowledgeFuture = new CompletableFuture<>();
TaskExecutorGateway taskExecutorGateway = createTaskExecutorGateway(taskCancellationFuture, taskSubmissionFuture, taskSubmissionAcknowledgeFuture);
LocalUnresolvedTaskManagerLocation localUnresolvedTaskManagerLocation = new LocalUnresolvedTaskManagerLocation();
registerTaskExecutorAndOfferSlots(jobMasterGateway, jobGraph.getJobID(), taskExecutorGateway, localUnresolvedTaskManagerLocation);
ExecutionAttemptID pendingExecutionId = taskSubmissionFuture.get();
// the execution has not been acknowledged yet by the TaskExecutor, but we already allow the
// ID to be in the heartbeat payload
jobMasterGateway.heartbeatFromTaskManager(localUnresolvedTaskManagerLocation.getResourceID(), new TaskExecutorToJobManagerHeartbeatPayload(new AccumulatorReport(Collections.emptyList()), new ExecutionDeploymentReport(Collections.singleton(pendingExecutionId))));
taskSubmissionAcknowledgeFuture.complete(Acknowledge.get());
deploymentTrackerWrapper.getTaskDeploymentFuture().get();
assertFalse(taskCancellationFuture.isDone());
}
Aggregations