public Set<ContainerModel> group(Set<TaskModel> taskModels, List<String> containersIds) {
    if (this.standbyTasksEnabled) {
      return generateStandbyTasks(this.taskNameGrouper.group(taskModels, containersIds), replicationFactor);
    } else {
      return this.taskNameGrouper.group(taskModels, containersIds);
    }
  }
This TaskNameGrouperProxy wraps around any given TaskNameGrouper.
In addition to apply the provided grouper, this grouper also generates
generates Standby-tasks and adds them to separate dedicated containers.
It adds (r-1) Standby-Tasks for each active task, where r is the replication factor.
Hence it adds r-1 additional containers for each regular container.

All Standby-tasks are assigned a TaskName with a "Standby" prefix.
The new containers carrying Standby tasks that are added are assigned containerIDs corresponding to its
active container, e.g., activeContainerID-replicaNumber
For e.g.,

If the initial container model map is:

Container 0 : (Partition 0, Partition 1)
Container 1 : (Partition 2, Partition 3)
with replicationFactor = 3

The generated containerModel map is:
Container 0 : (Partition 0, Partition 1)
Container 1 : (Partition 2, Partition 3)
Container 0-0 : (Standby-Partition 0-0, Standby-Partition 1-0)
Container 1-0 : (Standby-Partition 2-0, Standby-Partition 3-0)
Container 0-1 : (Standby-Partition 0-1, Standby-Partition 1-1)
Container 1-1 : (Standby-Partition 2-1, Standby-Partition 3-1)
samza-core/src/main/java/org/apache/samza/container/grouper/task/TaskNameGrouperProxy.java