Search in sources :

Example 1 with InputAlreadyClosedException

use of org.apache.tez.runtime.library.exceptions.InputAlreadyClosedException in project tez by apache.

the class Shuffle method waitForInput.

/**
 * Waits for the Shuffle and Merge to complete, and returns an iterator over the input.
 * @return an iterator over the fetched input.
 * @throws IOException
 * @throws InterruptedException
 */
public TezRawKeyValueIterator waitForInput() throws IOException, InterruptedException, TezException {
    Preconditions.checkState(runShuffleFuture != null, "waitForInput can only be called after run");
    TezRawKeyValueIterator kvIter = null;
    try {
        kvIter = runShuffleFuture.get();
    } catch (ExecutionException e) {
        Throwable cause = e.getCause();
        // Processor interrupted while waiting for errors, will see an InterruptedException.
        handleThrowable(cause);
    }
    if (isShutDown.get()) {
        throw new InputAlreadyClosedException();
    }
    if (throwable.get() != null) {
        handleThrowable(throwable.get());
    }
    return kvIter;
}
Also used : InputAlreadyClosedException(org.apache.tez.runtime.library.exceptions.InputAlreadyClosedException) ExecutionException(java.util.concurrent.ExecutionException) TezRawKeyValueIterator(org.apache.tez.runtime.library.common.sort.impl.TezRawKeyValueIterator)

Aggregations

ExecutionException (java.util.concurrent.ExecutionException)1 TezRawKeyValueIterator (org.apache.tez.runtime.library.common.sort.impl.TezRawKeyValueIterator)1 InputAlreadyClosedException (org.apache.tez.runtime.library.exceptions.InputAlreadyClosedException)1