/** * Rebalances the tasks using the provided {@link LocalityManager}. The goal is typically * to minimize changes to the ContainerModels, e.g. when the container count changes. * This helps maximize the consistency of task-container locality, which is useful for optimization. * Each time balance() is called, locality information is read, it is used to balance the tasks, * and then the new locality information is saved. * * If balancing cannot be applied, then {@link TaskNameGrouper#group(Set)} should be used to * retrieve an appropriate set of ContainerModels. i.e. this method is a complete replacement * for {@link TaskNameGrouper#group(Set)} * * Implementations should prefer to use the previous mapping rather than calling * {@link TaskNameGrouper#group(Set)} to enable external custom task assignments. * * @param tasks the tasks to group. * @param localityManager provides a persisted task to container map to use as a baseline * @return the grouped tasks in the form of ContainerModels */ @Deprecated default Set<ContainerModel> balance(Set<TaskModel> tasks, LocalityManager localityManager) { return group(tasks); } }