Search in sources :

Example 1 with TestOperatorEvent

use of org.apache.flink.runtime.operators.coordination.TestOperatorEvent in project flink by apache.

the class TaskExecutorOperatorEventHandlingTest method eventHandlingInTaskFailureFailsTask.

@Test
public void eventHandlingInTaskFailureFailsTask() throws Exception {
    final JobID jobId = new JobID();
    final ExecutionAttemptID eid = new ExecutionAttemptID();
    try (TaskSubmissionTestEnvironment env = createExecutorWithRunningTask(jobId, eid, OperatorEventFailingInvokable.class)) {
        final TaskExecutorGateway tmGateway = env.getTaskExecutorGateway();
        final CompletableFuture<?> resultFuture = tmGateway.sendOperatorEventToTask(eid, new OperatorID(), new SerializedValue<>(new TestOperatorEvent()));
        assertThat(resultFuture, futureWillCompleteExceptionally(FlinkException.class, Duration.ofSeconds(10)));
        assertEquals(ExecutionState.FAILED, env.getTaskSlotTable().getTask(eid).getExecutionState());
    }
}
Also used : TestOperatorEvent(org.apache.flink.runtime.operators.coordination.TestOperatorEvent) ExecutionAttemptID(org.apache.flink.runtime.executiongraph.ExecutionAttemptID) OperatorID(org.apache.flink.runtime.jobgraph.OperatorID) JobID(org.apache.flink.api.common.JobID) FlinkException(org.apache.flink.util.FlinkException) Test(org.junit.Test)

Example 2 with TestOperatorEvent

use of org.apache.flink.runtime.operators.coordination.TestOperatorEvent in project flink by apache.

the class AdaptiveSchedulerTest method testDeliverOperatorEventToCoordinatorFailsInIllegalState.

@Test(expected = TaskNotRunningException.class)
public void testDeliverOperatorEventToCoordinatorFailsInIllegalState() throws Exception {
    final AdaptiveScheduler scheduler = new AdaptiveSchedulerBuilder(createJobGraph(), mainThreadExecutor).build();
    scheduler.deliverOperatorEventToCoordinator(new ExecutionAttemptID(), new OperatorID(), new TestOperatorEvent());
}
Also used : TestOperatorEvent(org.apache.flink.runtime.operators.coordination.TestOperatorEvent) ExecutionAttemptID(org.apache.flink.runtime.executiongraph.ExecutionAttemptID) OperatorID(org.apache.flink.runtime.jobgraph.OperatorID) Test(org.junit.Test) ArchivedExecutionGraphTest(org.apache.flink.runtime.executiongraph.ArchivedExecutionGraphTest) DefaultSchedulerTest(org.apache.flink.runtime.scheduler.DefaultSchedulerTest)

Aggregations

ExecutionAttemptID (org.apache.flink.runtime.executiongraph.ExecutionAttemptID)2 OperatorID (org.apache.flink.runtime.jobgraph.OperatorID)2 TestOperatorEvent (org.apache.flink.runtime.operators.coordination.TestOperatorEvent)2 Test (org.junit.Test)2 JobID (org.apache.flink.api.common.JobID)1 ArchivedExecutionGraphTest (org.apache.flink.runtime.executiongraph.ArchivedExecutionGraphTest)1 DefaultSchedulerTest (org.apache.flink.runtime.scheduler.DefaultSchedulerTest)1 FlinkException (org.apache.flink.util.FlinkException)1