use of org.apache.flink.runtime.taskexecutor.AccumulatorReport 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.AccumulatorReport 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