in tez-dag/src/main/java/org/apache/tez/runtime/task/TezTaskRunner.java [90:165]
public boolean run() throws InterruptedException, IOException, TezException {
waitingThread = Thread.currentThread();
TaskRunnerCallable callable = new TaskRunnerCallable();
Throwable failureCause = null;
taskFuture = executor.submit(callable);
try {
taskFuture.get();
// Task could signal a fatal error and return control, or a failure while registering success.
failureCause = firstException;
} catch (InterruptedException e) {
LOG.info("Interrupted while waiting for task to complete. Interrupting task");
taskFuture.cancel(true);
if (shutdownRequested.get()) {
LOG.info("Shutdown requested... returning");
return false;
}
if (firstException != null) {
failureCause = firstException;
} else {
// Interrupted for some other reason.
failureCause = e;
}
} catch (ExecutionException e) {
// Exception thrown by the run() method itself.
Throwable cause = e.getCause();
if (cause instanceof FSError) {
// Not immediately fatal, this is an error reported by Hadoop FileSystem
failureCause = cause;
} else if (cause instanceof Error) {
LOG.error("Exception of type Error. Exiting now", cause);
ExitUtil.terminate(-1, cause);
// Effectively dead code. Must return something.
assert(false);
return false;
} else {
failureCause = cause;
}
} finally {
// Clear the interrupted status of the blocking thread, in case it is set after the
// InterruptedException was invoked.
taskReporter.unregisterTask(task.getTaskAttemptID());
Thread.interrupted();
}
if (failureCause != null) {
if (failureCause instanceof FSError) {
// Not immediately fatal, this is an error reported by Hadoop FileSystem
LOG.info("Encountered an FSError while executing task: " + task.getTaskAttemptID(),
failureCause);
throw (FSError) failureCause;
} else if (failureCause instanceof Error) {
LOG.error("Exception of type Error. Exiting now", failureCause);
ExitUtil.terminate(-1, failureCause);
// Effectively dead code. Must return something.
assert(false);
return false;
} else {
if (failureCause instanceof IOException) {
throw (IOException) failureCause;
} else if (failureCause instanceof TezException) {
throw (TezException) failureCause;
} else if (failureCause instanceof InterruptedException) {
throw (InterruptedException) failureCause;
} else {
throw new TezException(failureCause);
}
}
}
if (shutdownRequested.get()) {
LOG.info("Shutdown requested... returning");
return false;
}
return true;
}