rmatharu 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_r260920830
 
 

 ##########
 File path: 
samza-core/src/main/java/org/apache/samza/clustermanager/HostAwareContainerAllocator.java
 ##########
 @@ -81,13 +87,27 @@ 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 (standbyContainerManager.isPresent()) {
+
+            // if standby is enabled and an alternative-anyhost-resource is 
available, we try to use it
+            if (resourceAvailableOnAnyHost) {
+              
standbyContainerManager.get().handleExpiredResourceRequest(containerID, 
request, Optional.of(peekAllocatedResource(ResourceRequestState.ANY_HOST)), 
this, resourceRequestState);
+            } else {
+              
standbyContainerManager.get().handleExpiredResourceRequest(containerID, 
request, Optional.empty(), this, resourceRequestState);
+            }
+
           } else {
-            log.info("Request for container: {} on {} has expired. Requesting 
additional resources on ANY_HOST.", request.getContainerID(), 
request.getPreferredHost());
-            resourceRequestState.cancelResourceRequest(request);
-            requestResource(containerID, ResourceRequestState.ANY_HOST);
+
+            if (resourceAvailableOnAnyHost) {
 
 Review comment:
   This separation keeps the path taken in case standbyContainerManager is and 
isnt present clear.

----------------------------------------------------------------
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