use of com.netflix.titus.api.model.ResourceDimension in project titus-control-plane by Netflix.
the class Representation2ModelConvertions method asCoreEntity.
public static ApplicationSLA asCoreEntity(ApplicationSlaRepresentation representation) {
ResourceDimension resourceDimension = ResourceDimension.newBuilder().withCpus(representation.getInstanceCPU()).withMemoryMB(representation.getInstanceMemoryMB()).withDiskMB(representation.getInstanceDiskMB()).withNetworkMbs(representation.getInstanceNetworkMbs()).withGpu(representation.getInstanceGPU()).build();
Tier tier;
if (representation.getTier() != null) {
tier = Tier.valueOf(representation.getTier().name());
} else {
tier = Tier.Flex;
}
return ApplicationSLA.newBuilder().withAppName(representation.getAppName()).withTier(tier).withResourceDimension(resourceDimension).withInstanceCount(representation.getInstanceCount()).withSchedulerName(representation.getSchedulerName()).withResourcePool(representation.getResourcePool()).build();
}
use of com.netflix.titus.api.model.ResourceDimension in project titus-control-plane by Netflix.
the class ResourceDimensionsTest method testAligningUpToHigherCPU.
@Test
public void testAligningUpToHigherCPU() throws Exception {
ResourceDimension small2X = ResourceDimensionSample.SmallWithGpuAndOpportunisticX2.build();
ResourceDimension original = ResourceDimensionSample.SmallWithGpuAndOpportunistic.builder().withCpus(small2X.getCpu()).build();
assertThat(ResourceDimensions.alignUp(original, small2X)).isEqualTo(small2X);
}
use of com.netflix.titus.api.model.ResourceDimension in project titus-control-plane by Netflix.
the class ResourceDimensionsTest method testResourceDimensionAddition.
@Test
public void testResourceDimensionAddition() throws Exception {
ResourceDimension small = ResourceDimensionSample.SmallWithGpuAndOpportunistic.build();
ResourceDimension expected = ResourceDimensionSample.SmallWithGpuAndOpportunisticX2.build();
assertThat(ResourceDimensions.add(small, small)).isEqualTo(expected);
}
use of com.netflix.titus.api.model.ResourceDimension in project titus-control-plane by Netflix.
the class ResourceDimensionsTest method testResourceDimensionSubtraction.
@Test
public void testResourceDimensionSubtraction() throws Exception {
ResourceDimension large = ResourceDimensionSample.SmallWithGpuAndOpportunisticX2.build();
ResourceDimension small = ResourceDimensionSample.SmallWithGpuAndOpportunistic.build();
assertThat(ResourceDimensions.subtractPositive(large, small)).isEqualTo(small);
}
use of com.netflix.titus.api.model.ResourceDimension in project titus-control-plane by Netflix.
the class ResourceDimensionsTest method testResourceDimensionDivideAndRoundUp.
@Test
public void testResourceDimensionDivideAndRoundUp() throws Exception {
ResourceDimension large = ResourceDimensionSample.SmallWithGpuAndOpportunisticX2.build();
ResourceDimension largePlus = ResourceDimensionSample.SmallWithGpuAndOpportunisticX2.builder().withCpus(large.getCpu() + 1).build();
ResourceDimension small = ResourceDimensionSample.SmallWithGpuAndOpportunistic.build();
assertThat(ResourceDimensions.divideAndRoundUp(large, small)).isEqualTo(2);
assertThat(ResourceDimensions.divideAndRoundUp(largePlus, small)).isEqualTo(3);
}
Aggregations