@Test public void testAtLeastOneContainerCanBeScheduled() { when(schedulerConfiguration.getMaxLaunchingTasksPerMachine()).thenReturn(0); ConstraintEvaluator.Result result = constraint.evaluate( createTaskRequest(TASK_ID), createVirtualMachineCurrentStateMock(INSTANCE_ID, Collections.emptyList(), Collections.emptyList()), taskTrackerState); assertThat(result.isSuccessful()).isTrue(); }
@Override public Result evaluate(TaskRequest taskRequest, VirtualMachineCurrentState targetVM, TaskTrackerState taskTrackerState) { int total = targetVM.getRunningTasks().size() + targetVM.getTasksCurrentlyAssigned().size(); int max = Math.max(1, configuration.getMaxTasksPerMachine()); return total < max ? VALID : TOO_MANY_CONTAINERS; }
AgentContainerLimitSystemConstraint implements SystemConstraint { @Override public Result evaluate(TaskRequest taskRequest, VirtualMachineCurrentState targetVM, TaskTrackerState taskTrackerState) { int total = targetVM.getRunningTasks().size() + targetVM.getTasksCurrentlyAssigned().size(); int max = Math.max(1, configuration.getMaxTasksPerMachine()); return total < max ? VALID : TOO_MANY_CONTAINERS; } }
AgentContainerLimitSystemConstraint implements SystemConstraint { @Override public Result evaluate(TaskRequest taskRequest, VirtualMachineCurrentState targetVM, TaskTrackerState taskTrackerState) { int total = targetVM.getRunningTasks().size() + targetVM.getTasksCurrentlyAssigned().size(); int max = Math.max(1, configuration.getMaxTasksPerMachine()); return total < max ? VALID : TOO_MANY_CONTAINERS; } @Inject  AgentContainerLimitSystemConstraint(SchedulerConfiguration configuration); }
AgentContainerLimitSystemConstraint implements SystemConstraint { @Override public Result evaluate(TaskRequest taskRequest, VirtualMachineCurrentState targetVM, TaskTrackerState taskTrackerState) { int total = targetVM.getRunningTasks().size() + targetVM.getTasksCurrentlyAssigned().size(); int max = Math.max(1, configuration.getMaxTasksPerMachine()); return total < max ? VALID : TOO_MANY_CONTAINERS; } @Inject  AgentContainerLimitSystemConstraint(SchedulerConfiguration configuration); @Override String getName(); @Override Result evaluate(TaskRequest taskRequest, VirtualMachineCurrentState targetVM, TaskTrackerState taskTrackerState); static boolean isAgentContainerLimitSystemConstraint(String reason); }
AgentContainerLimitSystemConstraint implements SystemConstraint { @Override public Result evaluate(TaskRequest taskRequest, VirtualMachineCurrentState targetVM, TaskTrackerState taskTrackerState) { int total = targetVM.getRunningTasks().size() + targetVM.getTasksCurrentlyAssigned().size(); int max = Math.max(1, configuration.getMaxTasksPerMachine()); return total < max ? VALID : TOO_MANY_CONTAINERS; } @Inject  AgentContainerLimitSystemConstraint(SchedulerConfiguration configuration); @Override String getName(); @Override Result evaluate(TaskRequest taskRequest, VirtualMachineCurrentState targetVM, TaskTrackerState taskTrackerState); static boolean isAgentContainerLimitSystemConstraint(String reason); static final String NAME; }