use of org.apache.flink.runtime.taskexecutor.exceptions.TaskException in project flink by apache.
the class TaskExecutor method stopTask.
@RpcMethod
public Acknowledge stopTask(ExecutionAttemptID executionAttemptID) throws TaskException {
final Task task = taskSlotTable.getTask(executionAttemptID);
if (task != null) {
try {
task.stopExecution();
return Acknowledge.get();
} catch (Throwable t) {
throw new TaskException("Cannot stop task for execution " + executionAttemptID + '.', t);
}
} else {
final String message = "Cannot find task to stop for execution " + executionAttemptID + '.';
log.debug(message);
throw new TaskException(message);
}
}
use of org.apache.flink.runtime.taskexecutor.exceptions.TaskException in project flink by apache.
the class TaskExecutor method cancelTask.
@RpcMethod
public Acknowledge cancelTask(ExecutionAttemptID executionAttemptID) throws TaskException {
final Task task = taskSlotTable.getTask(executionAttemptID);
if (task != null) {
try {
task.cancelExecution();
return Acknowledge.get();
} catch (Throwable t) {
throw new TaskException("Cannot cancel task for execution " + executionAttemptID + '.', t);
}
} else {
final String message = "Cannot find task to stop for execution " + executionAttemptID + '.';
log.debug(message);
throw new TaskException(message);
}
}
use of org.apache.flink.runtime.taskexecutor.exceptions.TaskException in project flink by apache.
the class TaskExecutor method cancelTask.
@Override
public CompletableFuture<Acknowledge> cancelTask(ExecutionAttemptID executionAttemptID, Time timeout) {
final Task task = taskSlotTable.getTask(executionAttemptID);
if (task != null) {
try {
task.cancelExecution();
return CompletableFuture.completedFuture(Acknowledge.get());
} catch (Throwable t) {
return FutureUtils.completedExceptionally(new TaskException("Cannot cancel task for execution " + executionAttemptID + '.', t));
}
} else {
final String message = "Cannot find task to stop for execution " + executionAttemptID + '.';
log.debug(message);
return FutureUtils.completedExceptionally(new TaskException(message));
}
}
Aggregations