use of org.apache.ignite.internal.processors.hadoop.taskexecutor.HadoopTaskStatus in project ignite by apache.
the class HadoopChildProcessRunner method notifyTaskFinished.
/**
* @param taskInfo Finished task info.
* @param status Task status.
*/
private void notifyTaskFinished(final HadoopTaskInfo taskInfo, final HadoopTaskStatus status, boolean flush) {
final HadoopTaskState state = status.state();
final Throwable err = status.failCause();
if (!flush) {
try {
if (log.isDebugEnabled())
log.debug("Sending notification to parent node [taskInfo=" + taskInfo + ", state=" + state + ", err=" + err + ']');
comm.sendMessage(nodeDesc, new HadoopTaskFinishedMessage(taskInfo, status));
} catch (IgniteCheckedException e) {
log.error("Failed to send message to parent node (will terminate child process).", e);
shutdown();
terminate();
}
} else {
if (log.isDebugEnabled())
log.debug("Flushing shuffle messages before sending last task completion notification [taskInfo=" + taskInfo + ", state=" + state + ", err=" + err + ']');
final long start = U.currentTimeMillis();
try {
shuffleJob.flush().listen(new CI1<IgniteInternalFuture<?>>() {
@Override
public void apply(IgniteInternalFuture<?> f) {
long end = U.currentTimeMillis();
if (log.isDebugEnabled())
log.debug("Finished flushing shuffle messages [taskInfo=" + taskInfo + ", flushTime=" + (end - start) + ']');
try {
// Check for errors on shuffle.
f.get();
notifyTaskFinished(taskInfo, status, false);
} catch (IgniteCheckedException e) {
log.error("Failed to flush shuffle messages (will fail the task) [taskInfo=" + taskInfo + ", state=" + state + ", err=" + err + ']', e);
notifyTaskFinished(taskInfo, new HadoopTaskStatus(HadoopTaskState.FAILED, e), false);
}
}
});
} catch (IgniteCheckedException e) {
log.error("Failed to flush shuffle messages (will fail the task) [taskInfo=" + taskInfo + ", state=" + state + ", err=" + err + ']', e);
notifyTaskFinished(taskInfo, new HadoopTaskStatus(HadoopTaskState.FAILED, e), false);
}
}
}
use of org.apache.ignite.internal.processors.hadoop.taskexecutor.HadoopTaskStatus in project ignite by apache.
the class HadoopTaskFinishedMessage method readExternal.
/** {@inheritDoc} */
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
taskInfo = new HadoopTaskInfo();
taskInfo.readExternal(in);
status = new HadoopTaskStatus();
status.readExternal(in);
}
Aggregations