use of org.apache.flink.runtime.messages.TaskManagerMessages in project flink by apache.
the class TaskTest method testWatchDogInterruptsTask.
/**
* Tests that interrupt happens via watch dog if canceller is stuck in cancel.
* Task cancellation blocks the task canceller. Interrupt after cancel via
* cancellation watch dog.
*/
@Test
public void testWatchDogInterruptsTask() throws Exception {
Configuration config = new Configuration();
config.setLong(TaskManagerOptions.TASK_CANCELLATION_INTERVAL.key(), 5);
config.setLong(TaskManagerOptions.TASK_CANCELLATION_TIMEOUT.key(), 60 * 1000);
Task task = createTask(InvokableBlockingInCancel.class, config);
task.startTaskThread();
awaitLatch.await();
task.cancelExecution();
task.getExecutingThread().join();
// No fatal error
for (Object msg : taskManagerMessages) {
assertFalse("Unexpected FatalError message", msg instanceof TaskManagerMessages.FatalError);
}
}
use of org.apache.flink.runtime.messages.TaskManagerMessages in project flink by apache.
the class TaskTest method testInterruptableSharedLockInInvokeAndCancel.
/**
* The invoke() method holds a lock (trigger awaitLatch after acquisition)
* and cancel cannot complete because it also tries to acquire the same lock.
* This is resolved by the watch dog, no fatal error.
*/
@Test
public void testInterruptableSharedLockInInvokeAndCancel() throws Exception {
Configuration config = new Configuration();
config.setLong(TaskManagerOptions.TASK_CANCELLATION_INTERVAL, 5);
config.setLong(TaskManagerOptions.TASK_CANCELLATION_TIMEOUT, 50);
Task task = createTask(InvokableInterruptableSharedLockInInvokeAndCancel.class, config);
task.startTaskThread();
awaitLatch.await();
task.cancelExecution();
task.getExecutingThread().join();
// No fatal error
for (Object msg : taskManagerMessages) {
assertFalse("Unexpected FatalError message", msg instanceof TaskManagerMessages.FatalError);
}
}
Aggregations