diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/component/instance/ComponentInstance.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/component/instance/ComponentInstance.java index dab1e463c07..66c298d337c 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/component/instance/ComponentInstance.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/component/instance/ComponentInstance.java @@ -350,8 +350,10 @@ public class ComponentInstance implements EventHandler, // record in ATS LOG.info("Publishing component instance status {} {} ", event.getContainerId(), containerState); + int exitStatus = failureBeforeLaunch || event.getStatus() == null ? + ContainerExitStatus.INVALID : event.getStatus().getExitStatus(); compInstance.serviceTimelinePublisher.componentInstanceFinished( - event.getContainerId(), event.getStatus().getExitStatus(), + event.getContainerId(), exitStatus, containerState, containerDiag); } @@ -366,8 +368,10 @@ public class ComponentInstance implements EventHandler, if (compInstance.timelineServiceEnabled) { // record in ATS + int exitStatus = failureBeforeLaunch || event.getStatus() == null ? + ContainerExitStatus.INVALID : event.getStatus().getExitStatus(); compInstance.serviceTimelinePublisher.componentInstanceFinished( - event.getContainerId(), event.getStatus().getExitStatus(), + event.getContainerId(), exitStatus, containerState, containerDiag); }