Search in sources :

Example 1 with CoordinatedTask

use of org.apache.flink.runtime.jobgraph.tasks.CoordinatedTask in project flink by apache.

the class Task method deliverOperatorEvent.

/**
 * Dispatches an operator event to the invokable task.
 *
 * <p>If the event delivery did not succeed, this method throws an exception. Callers can use
 * that exception for error reporting, but need not react with failing this task (this method
 * takes care of that).
 *
 * @throws FlinkException This method throws exceptions indicating the reason why delivery did
 *     not succeed.
 */
public void deliverOperatorEvent(OperatorID operator, SerializedValue<OperatorEvent> evt) throws FlinkException {
    final TaskInvokable invokable = this.invokable;
    final ExecutionState currentState = this.executionState;
    if (invokable == null || (currentState != ExecutionState.RUNNING && currentState != ExecutionState.INITIALIZING)) {
        throw new TaskNotRunningException("Task is not running, but in state " + currentState);
    }
    if (invokable instanceof CoordinatedTask) {
        try {
            ((CoordinatedTask) invokable).dispatchOperatorEvent(operator, evt);
        } catch (Throwable t) {
            ExceptionUtils.rethrowIfFatalErrorOrOOM(t);
            if (getExecutionState() == ExecutionState.RUNNING || getExecutionState() == ExecutionState.INITIALIZING) {
                FlinkException e = new FlinkException("Error while handling operator event", t);
                failExternally(e);
                throw e;
            }
        }
    }
}
Also used : ExecutionState(org.apache.flink.runtime.execution.ExecutionState) TaskNotRunningException(org.apache.flink.runtime.operators.coordination.TaskNotRunningException) CoordinatedTask(org.apache.flink.runtime.jobgraph.tasks.CoordinatedTask) TaskInvokable(org.apache.flink.runtime.jobgraph.tasks.TaskInvokable) FlinkException(org.apache.flink.util.FlinkException)

Aggregations

ExecutionState (org.apache.flink.runtime.execution.ExecutionState)1 CoordinatedTask (org.apache.flink.runtime.jobgraph.tasks.CoordinatedTask)1 TaskInvokable (org.apache.flink.runtime.jobgraph.tasks.TaskInvokable)1 TaskNotRunningException (org.apache.flink.runtime.operators.coordination.TaskNotRunningException)1 FlinkException (org.apache.flink.util.FlinkException)1