Search in sources :

Example 1 with HadoopTaskStatus

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);
        }
    }
}
Also used : HadoopTaskStatus(org.apache.ignite.internal.processors.hadoop.taskexecutor.HadoopTaskStatus) HadoopTaskFinishedMessage(org.apache.ignite.internal.processors.hadoop.taskexecutor.external.HadoopTaskFinishedMessage) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) HadoopTaskState(org.apache.ignite.internal.processors.hadoop.taskexecutor.HadoopTaskState) IgniteInternalFuture(org.apache.ignite.internal.IgniteInternalFuture)

Example 2 with HadoopTaskStatus

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);
}
Also used : HadoopTaskStatus(org.apache.ignite.internal.processors.hadoop.taskexecutor.HadoopTaskStatus) HadoopTaskInfo(org.apache.ignite.internal.processors.hadoop.HadoopTaskInfo)

Aggregations

HadoopTaskStatus (org.apache.ignite.internal.processors.hadoop.taskexecutor.HadoopTaskStatus)2 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)1 IgniteInternalFuture (org.apache.ignite.internal.IgniteInternalFuture)1 HadoopTaskInfo (org.apache.ignite.internal.processors.hadoop.HadoopTaskInfo)1 HadoopTaskState (org.apache.ignite.internal.processors.hadoop.taskexecutor.HadoopTaskState)1 HadoopTaskFinishedMessage (org.apache.ignite.internal.processors.hadoop.taskexecutor.external.HadoopTaskFinishedMessage)1