You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@samza.apache.org by ni...@apache.org on 2016/03/23 23:40:53 UTC

samza git commit: SAMZA-893: fix a logic error in Host-Affinity container allocator

Repository: samza
Updated Branches:
  refs/heads/master 964f56e75 -> 04ae6f5ce


SAMZA-893: fix a logic error in Host-Affinity container allocator


Project: http://git-wip-us.apache.org/repos/asf/samza/repo
Commit: http://git-wip-us.apache.org/repos/asf/samza/commit/04ae6f5c
Tree: http://git-wip-us.apache.org/repos/asf/samza/tree/04ae6f5c
Diff: http://git-wip-us.apache.org/repos/asf/samza/diff/04ae6f5c

Branch: refs/heads/master
Commit: 04ae6f5ce76344b915a011cf1f6447c9faa15485
Parents: 964f56e
Author: Jacob Maes <ja...@gmail.com>
Authored: Wed Mar 23 15:40:04 2016 -0700
Committer: Yi Pan (Data Infrastructure) <ni...@gmail.com>
Committed: Wed Mar 23 15:40:04 2016 -0700

----------------------------------------------------------------------
 .../apache/samza/job/yarn/HostAwareContainerAllocator.java    | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/samza/blob/04ae6f5c/samza-yarn/src/main/java/org/apache/samza/job/yarn/HostAwareContainerAllocator.java
----------------------------------------------------------------------
diff --git a/samza-yarn/src/main/java/org/apache/samza/job/yarn/HostAwareContainerAllocator.java b/samza-yarn/src/main/java/org/apache/samza/job/yarn/HostAwareContainerAllocator.java
index 9797196..1d101fa 100644
--- a/samza-yarn/src/main/java/org/apache/samza/job/yarn/HostAwareContainerAllocator.java
+++ b/samza-yarn/src/main/java/org/apache/samza/job/yarn/HostAwareContainerAllocator.java
@@ -68,14 +68,15 @@ public class HostAwareContainerAllocator extends AbstractContainerAllocator {
         // No allocated container on preferredHost
         log.info("Did not find any allocated containers on preferred host {} for running container id {}",
             preferredHost, expectedContainerId);
+
         boolean expired = requestExpired(request);
-        if (expired || !hasAllocatedContainer(ANY_HOST)) {
+        if (expired && hasAllocatedContainer(ANY_HOST)) {
+          runContainer(request, ANY_HOST);
+        } else {
           log.info("Either the request timestamp {} is greater than container request timeout {}ms or we couldn't "
                   + "find any free allocated containers in the buffer. Breaking out of loop.",
               request.getRequestTimestamp(), CONTAINER_REQUEST_TIMEOUT);
           break;
-        } else {
-          runContainer(request, ANY_HOST);
         }
       }
     }