Source:
<code>public void assignResourceRequests() { while (hasPendingRequest()) { SamzaResourceRequest request = peekPendingRequest(); log.info("Handling request: " + request.getContainerID() + " " + request.getRequestTimestampMs() + " " + request.getPreferredHost()); String preferredHost = request.getPreferredHost(); String containerID = request.getContainerID(); if (hasAllocatedResource(preferredHost)) { log.info("Found a matched-container on the preferred host. Running on {}", containerID, preferredHost); checkStandbyConstraintsAndRunStreamProcessor(request, preferredHost, peekAllocatedResource(preferredHost)); state.matchedResourceRequests.incrementAndGet(); } else { log.info("Did not find any allocated resources on preferred host for running container id {}", preferredHost, containerID); boolean expired = requestExpired(request); boolean resourceAvailableOnAnyHost = hasAllocatedResource(ResourceRequestState.ANY_HOST); if (expired) { updateExpiryMetrics(request); <START> if (standbyContainerManager.isPresent()) { <END> 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 { if (resourceAvailableOnAnyHost) { log.info("Request for container: on has expired. Running on ANY_HOST", request.getContainerID(), request.getPreferredHost()); runStreamProcessor(request, ResourceRequestState.ANY_HOST); } 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); } } } else { log.info("Request for container: on has not yet expired. Request creation time: {}. Request timeout: {}", new Object[]{request.getContainerID(), request.getPreferredHost(), request.getRequestTimestampMs(), requestTimeout}); break; } } } }</code><technical_language>if standby is enabled? current behavior is issue any_host request. is changed</technical_language>

Target:
public void assignResourceRequests() { while (hasPendingRequest()) { SamzaResourceRequest request = peekPendingRequest(); log.info("Handling request: " + request.getContainerID() + " " + request.getRequestTimestampMs() + " " + request.getPreferredHost()); String preferredHost = request.getPreferredHost(); String containerID = request.getContainerID(); if (hasAllocatedResource(preferredHost)) { log.info("Found a matched-container on the preferred host. Running on {}", containerID, preferredHost); checkStandbyConstraintsAndRunStreamProcessor(request, preferredHost, peekAllocatedResource(preferredHost)); state.matchedResourceRequests.incrementAndGet(); } else { log.info("Did not find any allocated resources on preferred host for running container id {}", preferredHost, containerID); boolean expired = requestExpired(request); boolean resourceAvailableOnAnyHost = hasAllocatedResource(ResourceRequestState.ANY_HOST); if (expired) { updateExpiryMetrics(request); if (standbyContainerManager.isPresent()) { standbyContainerManager.get().handleExpiredResourceRequest(containerID, request, Optional.ofNullable(peekAllocatedResource(ResourceRequestState.ANY_HOST)), this, resourceRequestState); } else if (resourceAvailableOnAnyHost) { log.info("Request for container: on has expired. Running on ANY_HOST", request.getContainerID(), request.getPreferredHost()); runStreamProcessor(request, ResourceRequestState.ANY_HOST); } 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); } } else { log.info("Request for container: on has not yet expired. Request creation time: {}. Request timeout: {}", new Object[]{request.getContainerID(), request.getPreferredHost(), request.getRequestTimestampMs(), requestTimeout}); break; } } } }