@Test public void testBuildCapacityGroupUsage() { ReservationUsage cg1Usage = calculator.buildCapacityGroupUsage("cg1"); assertThat(cg1Usage).isNotNull(); assertThat(cg1Usage.getCpu()).isEqualTo(CONTAINER_RESOURCES.getCpu() * 4); assertThat(cg1Usage.getMemoryMB()).isEqualTo(CONTAINER_RESOURCES.getMemoryMB() * 4); assertThat(cg1Usage.getDiskMB()).isEqualTo(CONTAINER_RESOURCES.getDiskMB() * 4); assertThat(cg1Usage.getNetworkMbs()).isEqualTo(CONTAINER_RESOURCES.getNetworkMbps() * 4); }
public ReservationUsage buildCapacityGroupUsage(String capacityGroupName) { ApplicationSLA capacityGroup = capacityManagementService.getApplicationSLA(capacityGroupName); if (capacityGroup == null) { return ReservationUsage.none(); } List<Pair<Job, List<Task>>> jobsAndTasks = jobOperations.getJobsAndTasks(); ResourceAccumulator accumulator = new ResourceAccumulator(); for (Pair<Job, List<Task>> jobAndTasks : jobsAndTasks) { Job job = jobAndTasks.getLeft(); if (capacityGroupName.equals(job.getJobDescriptor().getCapacityGroup())) { processJob(accumulator, jobAndTasks); } } return accumulator.toReservationUsage(); }
ReservationUsageCalculator { public ReservationUsage buildCapacityGroupUsage(String capacityGroupName) { ApplicationSLA capacityGroup = capacityManagementService.getApplicationSLA(capacityGroupName); if (capacityGroup == null) { return ReservationUsage.none(); } List<Pair<Job, List<Task>>> jobsAndTasks = jobOperations.getJobsAndTasks(); ResourceAccumulator accumulator = new ResourceAccumulator(); for (Pair<Job, List<Task>> jobAndTasks : jobsAndTasks) { Job job = jobAndTasks.getLeft(); if (capacityGroupName.equals(job.getJobDescriptor().getCapacityGroup())) { processJob(accumulator, jobAndTasks); } } return accumulator.toReservationUsage(); } }
ReservationUsageCalculator { public ReservationUsage buildCapacityGroupUsage(String capacityGroupName) { ApplicationSLA capacityGroup = capacityManagementService.getApplicationSLA(capacityGroupName); if (capacityGroup == null) { return ReservationUsage.none(); } List<Pair<Job, List<Task>>> jobsAndTasks = jobOperations.getJobsAndTasks(); ResourceAccumulator accumulator = new ResourceAccumulator(); for (Pair<Job, List<Task>> jobAndTasks : jobsAndTasks) { Job job = jobAndTasks.getLeft(); if (capacityGroupName.equals(job.getJobDescriptor().getCapacityGroup())) { processJob(accumulator, jobAndTasks); } } return accumulator.toReservationUsage(); } @Inject  ReservationUsageCalculator(ReadOnlyJobOperations jobOperations,
                                      ApplicationSlaManagementService capacityManagementService); }
ReservationUsageCalculator { public ReservationUsage buildCapacityGroupUsage(String capacityGroupName) { ApplicationSLA capacityGroup = capacityManagementService.getApplicationSLA(capacityGroupName); if (capacityGroup == null) { return ReservationUsage.none(); } List<Pair<Job, List<Task>>> jobsAndTasks = jobOperations.getJobsAndTasks(); ResourceAccumulator accumulator = new ResourceAccumulator(); for (Pair<Job, List<Task>> jobAndTasks : jobsAndTasks) { Job job = jobAndTasks.getLeft(); if (capacityGroupName.equals(job.getJobDescriptor().getCapacityGroup())) { processJob(accumulator, jobAndTasks); } } return accumulator.toReservationUsage(); } @Inject  ReservationUsageCalculator(ReadOnlyJobOperations jobOperations,
                                      ApplicationSlaManagementService capacityManagementService); Map<String, ReservationUsage> buildUsage(); ReservationUsage buildCapacityGroupUsage(String capacityGroupName); }
ReservationUsageCalculator { public ReservationUsage buildCapacityGroupUsage(String capacityGroupName) { ApplicationSLA capacityGroup = capacityManagementService.getApplicationSLA(capacityGroupName); if (capacityGroup == null) { return ReservationUsage.none(); } List<Pair<Job, List<Task>>> jobsAndTasks = jobOperations.getJobsAndTasks(); ResourceAccumulator accumulator = new ResourceAccumulator(); for (Pair<Job, List<Task>> jobAndTasks : jobsAndTasks) { Job job = jobAndTasks.getLeft(); if (capacityGroupName.equals(job.getJobDescriptor().getCapacityGroup())) { processJob(accumulator, jobAndTasks); } } return accumulator.toReservationUsage(); } @Inject  ReservationUsageCalculator(ReadOnlyJobOperations jobOperations,
                                      ApplicationSlaManagementService capacityManagementService); Map<String, ReservationUsage> buildUsage(); ReservationUsage buildCapacityGroupUsage(String capacityGroupName);  }