Search in sources :

Example 16 with WorkerResourceSpec

use of org.apache.flink.runtime.resourcemanager.WorkerResourceSpec in project flink by apache.

the class SlotManagerUtilsTest method testGenerateTaskManagerTotalResourceProfile.

@Test
public void testGenerateTaskManagerTotalResourceProfile() {
    final ResourceProfile resourceProfile = ResourceProfile.newBuilder().setCpuCores(1.0).setTaskHeapMemoryMB(1).setTaskOffHeapMemoryMB(2).setNetworkMemoryMB(3).setManagedMemoryMB(4).setExtendedResource(new ExternalResource(EXTERNAL_RESOURCE_NAME, 1)).build();
    final WorkerResourceSpec workerResourceSpec = new WorkerResourceSpec.Builder().setCpuCores(1.0).setTaskHeapMemoryMB(1).setTaskOffHeapMemoryMB(2).setNetworkMemoryMB(3).setManagedMemoryMB(4).setExtendedResource(new ExternalResource(EXTERNAL_RESOURCE_NAME, 1)).build();
    assertThat(SlotManagerUtils.generateTaskManagerTotalResourceProfile(workerResourceSpec), equalTo(resourceProfile));
}
Also used : ResourceProfile(org.apache.flink.runtime.clusterframework.types.ResourceProfile) WorkerResourceSpec(org.apache.flink.runtime.resourcemanager.WorkerResourceSpec) ExternalResource(org.apache.flink.api.common.resources.ExternalResource) Test(org.junit.Test)

Aggregations

WorkerResourceSpec (org.apache.flink.runtime.resourcemanager.WorkerResourceSpec)16 Test (org.junit.Test)12 ResourceProfile (org.apache.flink.runtime.clusterframework.types.ResourceProfile)7 CompletableFuture (java.util.concurrent.CompletableFuture)5 ExternalResource (org.apache.flink.api.common.resources.ExternalResource)4 ResourceID (org.apache.flink.runtime.clusterframework.types.ResourceID)4 TestingTaskExecutorGatewayBuilder (org.apache.flink.runtime.taskexecutor.TestingTaskExecutorGatewayBuilder)4 Executor (java.util.concurrent.Executor)3 Time (org.apache.flink.api.common.time.Time)3 AllocationID (org.apache.flink.runtime.clusterframework.types.AllocationID)3 SlotID (org.apache.flink.runtime.clusterframework.types.SlotID)3 TaskExecutorConnection (org.apache.flink.runtime.resourcemanager.registration.TaskExecutorConnection)3 SlotReport (org.apache.flink.runtime.taskexecutor.SlotReport)3 SlotStatus (org.apache.flink.runtime.taskexecutor.SlotStatus)3 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 Collectors (java.util.stream.Collectors)2 IntStream (java.util.stream.IntStream)2