YARN-9197. Add safe guard against NPE for component instance failure.
Contributed by kyungwan nam
This commit is contained in:
parent
dacc1a759e
commit
8c7f6b2d4d
|
@ -350,8 +350,10 @@ public class ComponentInstance implements EventHandler<ComponentInstanceEvent>,
|
||||||
// record in ATS
|
// record in ATS
|
||||||
LOG.info("Publishing component instance status {} {} ",
|
LOG.info("Publishing component instance status {} {} ",
|
||||||
event.getContainerId(), containerState);
|
event.getContainerId(), containerState);
|
||||||
|
int exitStatus = failureBeforeLaunch || event.getStatus() == null ?
|
||||||
|
ContainerExitStatus.INVALID : event.getStatus().getExitStatus();
|
||||||
compInstance.serviceTimelinePublisher.componentInstanceFinished(
|
compInstance.serviceTimelinePublisher.componentInstanceFinished(
|
||||||
event.getContainerId(), event.getStatus().getExitStatus(),
|
event.getContainerId(), exitStatus,
|
||||||
containerState, containerDiag);
|
containerState, containerDiag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,8 +368,10 @@ public class ComponentInstance implements EventHandler<ComponentInstanceEvent>,
|
||||||
|
|
||||||
if (compInstance.timelineServiceEnabled) {
|
if (compInstance.timelineServiceEnabled) {
|
||||||
// record in ATS
|
// record in ATS
|
||||||
|
int exitStatus = failureBeforeLaunch || event.getStatus() == null ?
|
||||||
|
ContainerExitStatus.INVALID : event.getStatus().getExitStatus();
|
||||||
compInstance.serviceTimelinePublisher.componentInstanceFinished(
|
compInstance.serviceTimelinePublisher.componentInstanceFinished(
|
||||||
event.getContainerId(), event.getStatus().getExitStatus(),
|
event.getContainerId(), exitStatus,
|
||||||
containerState, containerDiag);
|
containerState, containerDiag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue