@Override public void containerStopped(String runnableName, int instanceId, String containerId, int exitStatus) { super.containerStopped(runnableName, instanceId, containerId, exitStatus); // Let the completed() method handle when a container has completed with no error if (exitStatus == 0) { return; } switch(programRunId.getType()) { case WORKFLOW: case SPARK: case MAPREDUCE: // For workflow, MapReduce, and spark, if there is an error, the program state is failure // We defer the actual publish to one of the completion methods (killed, completed, aborted) // as we need to know under what condition the container failed. lastContainerFailure = new ContainerFailure(runnableName, instanceId, containerId, exitStatus); break; default: // For other programs, the container will be re-launched - the program state will continue to be RUNNING // TODO Workers should be configured via runtime args // to support both retrying on failure, or just failing and not retrying. break; } }
@Override public void completed() { super.completed(); // On normal AM completion, based on the last container failure to publish the state if (lastContainerFailure == null) { programStateWriterWithHeartBeat.completed(); } else { lastContainerFailure.writeError(programStateWriterWithHeartBeat); } }
@Override public void containerStopped(String runnableName, int instanceId, String containerId, int exitStatus) { super.containerStopped(runnableName, instanceId, containerId, exitStatus); // Let the completed() method handle when a container has completed with no error if (exitStatus == 0) { return; } switch(programRunId.getType()) { case WORKFLOW: case SPARK: case MAPREDUCE: // For workflow, MapReduce, and spark, if there is an error, the program state is failure // We defer the actual publish to one of the completion methods (killed, completed, aborted) // as we need to know under what condition the container failed. lastContainerFailure = new ContainerFailure(runnableName, instanceId, containerId, exitStatus); break; default: // For other programs, the container will be re-launched - the program state will continue to be RUNNING // TODO Workers should be configured via runtime args // to support both retrying on failure, or just failing and not retrying. break; } }
@Override public void completed() { super.completed(); // On normal AM completion, based on the last container failure to publish the state if (lastContainerFailure == null) { programStateWriterWithHeartBeat.completed(); } else { lastContainerFailure.writeError(programStateWriterWithHeartBeat); } }