Search in sources :

Example 1 with TaskException

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);
    }
}
Also used : Task(org.apache.flink.runtime.taskmanager.Task) TaskException(org.apache.flink.runtime.taskexecutor.exceptions.TaskException) RpcMethod(org.apache.flink.runtime.rpc.RpcMethod)

Example 2 with TaskException

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);
    }
}
Also used : Task(org.apache.flink.runtime.taskmanager.Task) TaskException(org.apache.flink.runtime.taskexecutor.exceptions.TaskException) RpcMethod(org.apache.flink.runtime.rpc.RpcMethod)

Example 3 with TaskException

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));
    }
}
Also used : Task(org.apache.flink.runtime.taskmanager.Task) TaskException(org.apache.flink.runtime.taskexecutor.exceptions.TaskException)

Aggregations

TaskException (org.apache.flink.runtime.taskexecutor.exceptions.TaskException)3 Task (org.apache.flink.runtime.taskmanager.Task)3 RpcMethod (org.apache.flink.runtime.rpc.RpcMethod)2