Set<ContainerModel> generateStandbyTasks(Set<ContainerModel> containerModels, int replicationFactor) {
    LOG.info("Received current containerModel map : {}, replicationFactor : {}", containerModels, replicationFactor);
    Set<ContainerModel> buddyContainers = new HashSet<>();

    for (ContainerModel activeContainer : containerModels) {
      for (int replicaNum = 0; replicaNum < replicationFactor - 1; replicaNum++) {
        String buddyContainerId = StandbyTaskUtil.getStandbyContainerId(activeContainer.getId(), replicaNum);

        ContainerModel buddyContainerModel =
            new ContainerModel(buddyContainerId, getTaskModelForBuddyContainer(activeContainer.getTasks(), replicaNum));

        buddyContainers.add(buddyContainerModel);
      }
    }

    LOG.info("Adding buddy containers : {}", buddyContainers);
    buddyContainers.addAll(containerModels);
    return buddyContainers;
  }
Generate a container model map with standby tasks added and grouped into buddy containers.
 Package-private for testing.

@param containerModels The initial container model map.
@param replicationFactor The desired replication factor, if the replication-factor is n, we add n-1 standby tasks for each active task.
@return The generated map of containerModels with added containers, and the initial regular containers
samza-core/src/main/java/org/apache/samza/container/grouper/task/TaskNameGrouperProxy.java