public LocalityModel readLocality() {
    Map<String, ProcessorLocality> containerLocalityMap = new HashMap<>();

    metadataStore.all().forEach((processorId, valueBytes) -> {
      if (valueBytes != null) {
        String locationId = valueSerde.fromBytes(valueBytes);
        containerLocalityMap.put(processorId, new ProcessorLocality(processorId, locationId));
      }
    });
    if (LOG.isDebugEnabled()) {
      for (Map.Entry<String, ProcessorLocality> entry : containerLocalityMap.entrySet()) {
        LOG.debug(String.format("Locality for container %s: %s", entry.getKey(), entry.getValue().host()));
      }
    }

    return new LocalityModel(containerLocalityMap);
  }
Fetch the processor locality information from the {@link MetadataStore}. In YARN deployment model, the
processor refers to the samza container.

@return the {@code LocalityModel} for the job
samza-core/src/main/java/org/apache/samza/container/LocalityManager.java