use of com.mesosphere.sdk.offer.ResourceUtils in project dcos-commons by mesosphere.
the class OfferEvaluatorPortsTest method getExpectedExecutorResources.
private Collection<Resource> getExpectedExecutorResources(Protos.ExecutorInfo executorInfo) {
String executorCpuId = executorInfo.getResourcesList().stream().filter(r -> r.getName().equals("cpus")).map(ResourceUtils::getResourceId).filter(o -> o.isPresent()).map(o -> o.get()).findFirst().get();
String executorMemId = executorInfo.getResourcesList().stream().filter(r -> r.getName().equals("mem")).map(ResourceUtils::getResourceId).filter(o -> o.isPresent()).map(o -> o.get()).findFirst().get();
String executorDiskId = executorInfo.getResourcesList().stream().filter(r -> r.getName().equals("disk")).map(ResourceUtils::getResourceId).filter(o -> o.isPresent()).map(o -> o.get()).findFirst().get();
Resource expectedExecutorCpu = ResourceTestUtils.getReservedCpus(0.1, executorCpuId);
Resource expectedExecutorMem = ResourceTestUtils.getReservedMem(32, executorMemId);
Resource expectedExecutorDisk = ResourceTestUtils.getReservedDisk(256, executorDiskId);
return new ArrayList<>(Arrays.asList(expectedExecutorCpu, expectedExecutorMem, expectedExecutorDisk));
}
Aggregations