helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kisho...@apache.org
Subject git commit: Almost complete working example of Helloworld
Date Fri, 21 Feb 2014 07:40:20 GMT
Repository: helix
Updated Branches:
  refs/heads/helix-provisioning 8b19cfc77 -> 970770acf


Almost complete working example of Helloworld


Project: http://git-wip-us.apache.org/repos/asf/helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/970770ac
Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/970770ac
Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/970770ac

Branch: refs/heads/helix-provisioning
Commit: 970770acf5c2cf6d267ebb112534c1a22c63a4bb
Parents: 8b19cfc
Author: Kishore Gopalakrishna <g.kishore@gmail.com>
Authored: Thu Feb 20 23:40:07 2014 -0800
Committer: Kishore Gopalakrishna <g.kishore@gmail.com>
Committed: Thu Feb 20 23:40:07 2014 -0800

----------------------------------------------------------------------
 .../provisioning/yarn/NMCallbackHandler.java    | 27 +++++++++++---------
 1 file changed, 15 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/970770ac/helix-provisioning/src/main/java/org/apache/helix/provisioning/yarn/NMCallbackHandler.java
----------------------------------------------------------------------
diff --git a/helix-provisioning/src/main/java/org/apache/helix/provisioning/yarn/NMCallbackHandler.java
b/helix-provisioning/src/main/java/org/apache/helix/provisioning/yarn/NMCallbackHandler.java
index 3735e7a..da6c01f 100644
--- a/helix-provisioning/src/main/java/org/apache/helix/provisioning/yarn/NMCallbackHandler.java
+++ b/helix-provisioning/src/main/java/org/apache/helix/provisioning/yarn/NMCallbackHandler.java
@@ -10,6 +10,7 @@ import org.apache.hadoop.yarn.api.records.ContainerId;
 import org.apache.hadoop.yarn.api.records.ContainerStatus;
 import org.apache.hadoop.yarn.client.api.AMRMClient.ContainerRequest;
 import org.apache.hadoop.yarn.client.api.async.NMClientAsync;
+import org.apache.log4j.Logger;
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.util.concurrent.SettableFuture;
@@ -17,6 +18,7 @@ import com.google.common.util.concurrent.SettableFuture;
 @VisibleForTesting
 class NMCallbackHandler implements NMClientAsync.CallbackHandler {
 
+  private Logger LOG = Logger.getLogger(NMCallbackHandler.class);
   private ConcurrentMap<ContainerId, Container> containers =
       new ConcurrentHashMap<ContainerId, Container>();
   private final GenericApplicationMaster applicationMaster;
@@ -31,25 +33,26 @@ class NMCallbackHandler implements NMClientAsync.CallbackHandler {
 
   @Override
   public void onContainerStopped(ContainerId containerId) {
-    if (GenericApplicationMaster.LOG.isDebugEnabled()) {
-      GenericApplicationMaster.LOG.debug("Succeeded to stop Container " + containerId);
+    LOG.info("Succeeded to stop Container " + containerId);
+    Container container = containers.get(containerId);
+    if (container != null) {
+      applicationMaster.nmClientAsync.getContainerStatusAsync(containerId, container.getNodeId());
     }
+    SettableFuture<ContainerStopResponse> settableFuture =
+        applicationMaster.containerStopMap.get(containerId);
+    ContainerStopResponse value = new ContainerStopResponse();
+    settableFuture.set(value);
     containers.remove(containerId);
   }
 
   @Override
   public void onContainerStatusReceived(ContainerId containerId, ContainerStatus containerStatus)
{
-    if (GenericApplicationMaster.LOG.isDebugEnabled()) {
-      GenericApplicationMaster.LOG.debug("Container Status: id=" + containerId + ", status="
-          + containerStatus);
-    }
+    LOG.info("Container Status: id=" + containerId + ", status=" + containerStatus);
   }
 
   @Override
   public void onContainerStarted(ContainerId containerId, Map<String, ByteBuffer> allServiceResponse)
{
-    if (GenericApplicationMaster.LOG.isDebugEnabled()) {
-      GenericApplicationMaster.LOG.debug("Succeeded to start Container " + containerId);
-    }
+    LOG.debug("Succeeded to start Container " + containerId);
 
     Container container = containers.get(containerId);
     if (container != null) {
@@ -63,18 +66,18 @@ class NMCallbackHandler implements NMClientAsync.CallbackHandler {
 
   @Override
   public void onStartContainerError(ContainerId containerId, Throwable t) {
-    GenericApplicationMaster.LOG.error("Failed to start Container " + containerId);
+    LOG.error("Failed to start Container " + containerId);
     containers.remove(containerId);
   }
 
   @Override
   public void onGetContainerStatusError(ContainerId containerId, Throwable t) {
-    GenericApplicationMaster.LOG.error("Failed to query the status of Container " + containerId);
+    LOG.error("Failed to query the status of Container " + containerId);
   }
 
   @Override
   public void onStopContainerError(ContainerId containerId, Throwable t) {
-    GenericApplicationMaster.LOG.error("Failed to stop Container " + containerId);
+    LOG.error("Failed to stop Container " + containerId);
     containers.remove(containerId);
   }
 }


Mime
View raw message