Source:
<code>boolean checkStandbyConstraints(String containerIdToStart, String host) { List<String> containerIDsForStandbyConstraints = this.standbyContainerConstraints.get(containerIdToStart); for (String containerID : containerIDsForStandbyConstraints) { SamzaResource resource = samzaApplicationState.pendingProcessors.get(containerID); if (resource != null) { <START> if (!resource.getHost().equals(ResourceRequestState.ANY_HOST) && !host.equals(ResourceRequestState.ANY_HOST) <END> && faultDomainManager.checkHostsOnSameFaultDomain(host, resource.getHost())) { log.info("Container cannot be started on host because container is already scheduled on this rack", containerIdToStart, host, containerID); return false; } else if (resource.getHost().equals(host)) { log.info("Container cannot be started on host because container is already scheduled on this host", containerIdToStart, host, containerID); return false; } } resource = samzaApplicationState.runningProcessors.get(containerID); if (resource != null) { if (!resource.getHost().equals(ResourceRequestState.ANY_HOST) && !host.equals(ResourceRequestState.ANY_HOST) && faultDomainManager.checkHostsOnSameFaultDomain(host, resource.getHost())) { log.info("Container cannot be started on host because container is already running on this rack", containerIdToStart, host, containerID); return false; } else if (resource.getHost().equals(host)) { log.info("Container cannot be started on host because container is already running on this host", containerIdToStart, host, containerID); return false; } } } return true; }</code><technical_language>1. if host = ANY_HOST resource.getHost is ANY_HOST vice versa? 2. earlier in StandbyContainerManager - is a request issue ANY_HOST fault domain set. is a pending processor ANY_HOST fault domain? a resource request a set of allowed fault domains a specific fault domain - is a pending processor started fault domain this standby? do hope catch pending processor runs invokes this checkStandbyConstraints find current standby in runningProcessors catch in check below? If this is case, original logic checking pendingProcessors all</technical_language>

Target:
boolean checkStandbyConstraints(String containerIdToStart, String host) { List<String> containerIDsForStandbyConstraints = this.standbyContainerConstraints.get(containerIdToStart); for (String containerID : containerIDsForStandbyConstraints) { SamzaResource resource = samzaApplicationState.pendingProcessors.get(containerID); if (resource != null && isFaultDomainAwareStandbyEnabled && faultDomainManager.hasSameFaultDomains(host, resource.getHost())) { log.info("Container cannot be started on host because container is already scheduled on this fault domain", containerIdToStart, host, containerID); if (StandbyTaskUtil.isStandbyContainer(containerIdToStart)) { samzaApplicationState.failedFaultDomainAwareContainerAllocations.incrementAndGet(); } return false; } else if (resource != null && resource.getHost().equals(host)) { log.info("Container cannot be started on host because container is already scheduled on this host", containerIdToStart, host, containerID); return false; } resource = samzaApplicationState.runningProcessors.get(containerID); if (resource != null && isFaultDomainAwareStandbyEnabled && faultDomainManager.hasSameFaultDomains(host, resource.getHost())) { log.info("Container cannot be started on host because container is already running on this fault domain", containerIdToStart, host, containerID); if (StandbyTaskUtil.isStandbyContainer(containerIdToStart)) { samzaApplicationState.failedFaultDomainAwareContainerAllocations.incrementAndGet(); } return false; } else if (resource != null && resource.getHost().equals(host)) { log.info("Container cannot be started on host because container is already running on this host", containerIdToStart, host, containerID); return false; } } return true; }