Search in sources :

Example 1 with GroupByContainerCount

use of org.apache.samza.container.grouper.task.GroupByContainerCount in project samza by apache.

the class TestApplicationMasterRestClient method generateContainers.

private HashMap<String, ContainerModel> generateContainers() {
    Set<TaskModel> taskModels = ImmutableSet.of(new TaskModel(new TaskName("task1"), ImmutableSet.of(new SystemStreamPartition(new SystemStream("system1", "stream1"), new Partition(0))), new Partition(0)), new TaskModel(new TaskName("task2"), ImmutableSet.of(new SystemStreamPartition(new SystemStream("system1", "stream1"), new Partition(1))), new Partition(1)));
    GroupByContainerCount grouper = new GroupByContainerCount(2);
    Set<ContainerModel> containerModels = grouper.group(taskModels);
    HashMap<String, ContainerModel> containers = new HashMap<>();
    for (ContainerModel containerModel : containerModels) {
        containers.put(containerModel.getId(), containerModel);
    }
    return containers;
}
Also used : SystemStreamPartition(org.apache.samza.system.SystemStreamPartition) Partition(org.apache.samza.Partition) GroupByContainerCount(org.apache.samza.container.grouper.task.GroupByContainerCount) TaskName(org.apache.samza.container.TaskName) HashMap(java.util.HashMap) SystemStream(org.apache.samza.system.SystemStream) TaskModel(org.apache.samza.job.model.TaskModel) SystemStreamPartition(org.apache.samza.system.SystemStreamPartition) ContainerModel(org.apache.samza.job.model.ContainerModel)

Aggregations

HashMap (java.util.HashMap)1 Partition (org.apache.samza.Partition)1 TaskName (org.apache.samza.container.TaskName)1 GroupByContainerCount (org.apache.samza.container.grouper.task.GroupByContainerCount)1 ContainerModel (org.apache.samza.job.model.ContainerModel)1 TaskModel (org.apache.samza.job.model.TaskModel)1 SystemStream (org.apache.samza.system.SystemStream)1 SystemStreamPartition (org.apache.samza.system.SystemStreamPartition)1