use of org.apache.flink.runtime.executiongraph.ExecutionAttemptID in project flink by apache.
the class TaskExecutorOperatorEventHandlingTest method eventToCoordinatorDeliveryFailureFailsTask.
@Test
public void eventToCoordinatorDeliveryFailureFailsTask() throws Exception {
final JobID jobId = new JobID();
final ExecutionAttemptID eid = new ExecutionAttemptID();
try (TaskSubmissionTestEnvironment env = createExecutorWithRunningTask(jobId, eid, OperatorEventSendingInvokable.class)) {
final Task task = env.getTaskSlotTable().getTask(eid);
task.getExecutingThread().join(10_000);
assertEquals(ExecutionState.FAILED, task.getExecutionState());
}
}
use of org.apache.flink.runtime.executiongraph.ExecutionAttemptID in project flink by apache.
the class TaskExecutionStateTest method testEqualsHashCode.
@Test
public void testEqualsHashCode() {
try {
final ExecutionAttemptID executionId = new ExecutionAttemptID();
final ExecutionState state = ExecutionState.RUNNING;
final Throwable error = new RuntimeException("some test error message");
TaskExecutionState s1 = new TaskExecutionState(executionId, state, error);
TaskExecutionState s2 = new TaskExecutionState(executionId, state, error);
assertEquals(s1.hashCode(), s2.hashCode());
assertEquals(s1, s2);
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
use of org.apache.flink.runtime.executiongraph.ExecutionAttemptID in project flink by apache.
the class TaskSlotTest method testTaskSlotClosedOnlyWhenAddedTasksTerminated.
@Test
public void testTaskSlotClosedOnlyWhenAddedTasksTerminated() throws Exception {
try (TaskSlot<TaskSlotPayload> taskSlot = createTaskSlot()) {
taskSlot.markActive();
TestingTaskSlotPayload task = new TestingTaskSlotPayload(JOB_ID, new ExecutionAttemptID(), ALLOCATION_ID);
taskSlot.add(task);
CompletableFuture<Void> closingFuture = taskSlot.closeAsync();
task.waitForFailure();
MemoryManager memoryManager = taskSlot.getMemoryManager();
assertThat(closingFuture.isDone(), is(false));
assertThat(memoryManager.isShutdown(), is(false));
task.terminate();
closingFuture.get();
assertThat(memoryManager.isShutdown(), is(true));
}
}
use of org.apache.flink.runtime.executiongraph.ExecutionAttemptID in project flink by apache.
the class TaskAsyncCallTest method createTask.
private Task createTask(Class<? extends AbstractInvokable> invokableClass) throws Exception {
final TestingClassLoaderLease classLoaderHandle = TestingClassLoaderLease.newBuilder().setGetOrResolveClassLoaderFunction((permanentBlobKeys, urls) -> TestingUserCodeClassLoader.newBuilder().setClassLoader(new TestUserCodeClassLoader()).build()).build();
ResultPartitionConsumableNotifier consumableNotifier = new NoOpResultPartitionConsumableNotifier();
PartitionProducerStateChecker partitionProducerStateChecker = mock(PartitionProducerStateChecker.class);
Executor executor = mock(Executor.class);
TaskMetricGroup taskMetricGroup = UnregisteredMetricGroups.createUnregisteredTaskMetricGroup();
JobInformation jobInformation = new JobInformation(new JobID(), "Job Name", new SerializedValue<>(new ExecutionConfig()), new Configuration(), Collections.emptyList(), Collections.emptyList());
TaskInformation taskInformation = new TaskInformation(new JobVertexID(), "Test Task", 1, 1, invokableClass.getName(), new Configuration());
return new Task(jobInformation, taskInformation, new ExecutionAttemptID(), new AllocationID(), 0, 0, Collections.<ResultPartitionDeploymentDescriptor>emptyList(), Collections.<InputGateDeploymentDescriptor>emptyList(), mock(MemoryManager.class), mock(IOManager.class), shuffleEnvironment, new KvStateService(new KvStateRegistry(), null, null), mock(BroadcastVariableManager.class), new TaskEventDispatcher(), ExternalResourceInfoProvider.NO_EXTERNAL_RESOURCES, new TestTaskStateManager(), mock(TaskManagerActions.class), mock(InputSplitProvider.class), mock(CheckpointResponder.class), new NoOpTaskOperatorEventGateway(), new TestGlobalAggregateManager(), classLoaderHandle, mock(FileCache.class), new TestingTaskManagerRuntimeInfo(), taskMetricGroup, consumableNotifier, partitionProducerStateChecker, executor);
}
use of org.apache.flink.runtime.executiongraph.ExecutionAttemptID in project flink by apache.
the class TaskSlotTableImplTest method testRemoveTaskCallsFreeSlotAction.
@Test(timeout = 10000)
public void testRemoveTaskCallsFreeSlotAction() throws Exception {
final JobID jobId = new JobID();
final ExecutionAttemptID executionAttemptId = new ExecutionAttemptID();
final AllocationID allocationId = new AllocationID();
CompletableFuture<AllocationID> freeSlotFuture = new CompletableFuture<>();
SlotActions slotActions = new TestingSlotActions(freeSlotFuture::complete, (aid, uid) -> {
});
TaskSlotPayload task = new TestingTaskSlotPayload(jobId, executionAttemptId, allocationId).terminate();
try (final TaskSlotTable<TaskSlotPayload> taskSlotTable = createTaskSlotTableWithStartedTask(task, slotActions)) {
// we have to initiate closing of the slot externally
// to enable that the last remaining finished task does the final slot freeing
taskSlotTable.freeSlot(allocationId);
taskSlotTable.removeTask(executionAttemptId);
assertThat(freeSlotFuture.get(), is(allocationId));
}
}
Aggregations