|
@@ -56,6 +56,7 @@ import org.apache.hadoop.yarn.server.nodemanager.DeletionService;
|
|
|
import org.apache.hadoop.yarn.server.nodemanager.LocalDirsHandlerService;
|
|
|
import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationEvent;
|
|
|
import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationEventType;
|
|
|
+import org.apache.hadoop.yarn.server.nodemanager.containermanager.container.Container;
|
|
|
import org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.LogHandler;
|
|
|
import org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerAppFinishedEvent;
|
|
|
import org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerAppStartedEvent;
|
|
@@ -423,8 +424,14 @@ public class LogAggregationService extends AbstractService implements
|
|
|
+ ", did it fail to start?");
|
|
|
return;
|
|
|
}
|
|
|
- ContainerType containerType = context.getContainers().get(
|
|
|
- containerId).getContainerTokenIdentifier().getContainerType();
|
|
|
+ Container container = context.getContainers().get(containerId);
|
|
|
+ if (null == container) {
|
|
|
+ LOG.warn("Log aggregation cannot be started for " + containerId
|
|
|
+ + ", as its an absent container");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ ContainerType containerType =
|
|
|
+ container.getContainerTokenIdentifier().getContainerType();
|
|
|
aggregator.startContainerLogAggregation(
|
|
|
new ContainerLogContext(containerId, containerType, exitCode));
|
|
|
}
|