Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Be smarter about shutting down containers when we get exceptions chec…

…king their status
  • Loading branch information...
commit bcf23c5c1a4101321be896f51bd205a9756dcef0 1 parent a3eda2d
@jwills jwills authored
View
24 java/master/src/main/java/com/cloudera/kitten/appmaster/service/ApplicationMasterServiceImpl.java
@@ -306,7 +306,7 @@ public void stopServices() {
private final ContainerLaunchParameters params;
private ContainerManager containerManager;
- private ContainerStatus status;
+ private ContainerState state;
private int failedStatusChecks;
public ContainerService(Container container, ContainerLaunchParameters params) {
@@ -348,28 +348,28 @@ protected void runOneIteration() throws Exception {
req.setContainerId(container.getId());
try {
GetContainerStatusResponse resp = containerManager.getContainerStatus(req);
- this.status = resp.getStatus();
+ this.state = resp.getStatus().getState();
} catch (YarnRemoteException e) {
- LOG.warn("Exception getting status for " + container.getId(), e);
- failedStatusChecks++;
- // TODO: configure this
- if (status == null || failedStatusChecks == 3) {
- stop();
- return;
+ LOG.info("Exception checking status of " + container.getId() + ", stopping");
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Exception details for " + container.getId(), e);
}
+ this.state = ContainerState.COMPLETE;
+ stop();
+ return;
}
- if (status != null) {
- LOG.info("Current status for " + container.getId() + ": " + status.getState());
+ if (state != null) {
+ LOG.info("Current status for " + container.getId() + ": " + state);
}
- if (status != null && status.getState() == ContainerState.COMPLETE) {
+ if (state != null && state == ContainerState.COMPLETE) {
stop();
}
}
@Override
protected void shutDown() throws Exception {
- if (status != null && status.getState() != ContainerState.COMPLETE) {
+ if (state != null && state != ContainerState.COMPLETE) {
// We need to explicitly release the container.
LOG.info("Stopping " + container.getId());
StopContainerRequest req = Records.newRecord(StopContainerRequest.class);
Please sign in to comment.
Something went wrong with that request. Please try again.