public void requestResources(Map<String, String> processorToHostMapping) {
    for (Map.Entry<String, String> entry : processorToHostMapping.entrySet()) {
      String processorId = entry.getKey();
      String preferredHost = entry.getValue();
      if (!hostAffinityEnabled) {
        preferredHost = ResourceRequestState.ANY_HOST;
      } else if (preferredHost == null) {
        LOG.info("No preferred host mapping found for Processor ID: {}. Requesting resource on ANY_HOST", processorId);
        preferredHost = ResourceRequestState.ANY_HOST;
      }
      requestResource(processorId, preferredHost);
    }
  }
Called during initial request for resources

@param processorToHostMapping A Map of [processorId, hostName], where processorId is the ID of the Samza processor
                              to run on the resource. hostName is the host on which the resource should be allocated.
                              The hostName value is null, either
                               - when host-affinity has never been enabled, or
                               - when host-affinity is enabled and job is run for the first time
                               - when the number of containers has been increased.
samza-core/src/main/java/org/apache/samza/clustermanager/ContainerAllocator.java