vjagadish1989 commented on a change in pull request #903: SEP-19: Allocator 
changes for standby-aware container allocation, and active container failover
URL: https://github.com/apache/samza/pull/903#discussion_r256072645
 
 

 ##########
 File path: 
samza-core/src/main/java/org/apache/samza/clustermanager/HostAwareContainerAllocator.java
 ##########
 @@ -81,12 +102,24 @@ public void assignResourceRequests()  {
         if (expired) {
           updateExpiryMetrics(request);
           if (resourceAvailableOnAnyHost) {
-            log.info("Request for container: {} on {} has expired. Running on 
ANY_HOST", request.getContainerID(), request.getPreferredHost());
-            runStreamProcessor(request, ResourceRequestState.ANY_HOST);
+            // if standby is not enabled, request a anyhost request
+            if (!new JobConfig(config).getStandbyTasksEnabled()) {
+              log.info("Request for container: {} on {} has expired. Running 
on ANY_HOST", request.getContainerID(),
+                  request.getPreferredHost());
+              runStreamProcessor(request, ResourceRequestState.ANY_HOST);
+            } else if (StandbyTaskUtil.isStandbyContainer(containerID)) {
+              // only standby resources can be on anyhost rightaway
+              checkStandbyTaskConstraintsAndRunStreamProcessor(request, 
ResourceRequestState.ANY_HOST,
+                  peekAllocatedResource(ResourceRequestState.ANY_HOST), state);
+            } else {
+              // re-requesting resource for active container
 
 Review comment:
   this looks a little bit complex. Is this else block needed - esp., when we 
are doing a similar action in L:120-122

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to