tillrohrmann commented on a change in pull request #7662: [FLINK-10431]
Extraction of scheduling-related code from SlotPool into preliminary Scheduler
(rebased)
URL: https://github.com/apache/flink/pull/7662#discussion_r256863219
##########
File path:
flink-runtime/src/test/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolTest.java
##########
@@ -97,34 +93,30 @@
private TestingResourceManagerGateway resourceManagerGateway;
+ private ComponentMainThreadExecutor mainThreadExecutor =
+
TestingComponentMainThreadExecutorServiceAdapter.forMainThread();
+
@Before
public void setUp() throws Exception {
- this.rpcService = new TestingRpcService();
this.jobId = new JobID();
taskManagerLocation = new LocalTaskManagerLocation();
taskManagerGateway = new SimpleAckingTaskManagerGateway();
resourceManagerGateway = new TestingResourceManagerGateway();
}
- @After
- public void tearDown() throws Exception {
- RpcUtils.terminateRpcService(rpcService, timeout);
- }
-
@Test
public void testAllocateSimpleSlot() throws Exception {
CompletableFuture<SlotRequest> slotRequestFuture = new
CompletableFuture<>();
- resourceManagerGateway.setRequestSlotConsumer(slotRequest ->
slotRequestFuture.complete(slotRequest));
-
- final SlotPool slotPool = new SlotPool(rpcService, jobId,
LocationPreferenceSchedulingStrategy.getInstance());
+
resourceManagerGateway.setRequestSlotConsumer(slotRequestFuture::complete);
- try {
- SlotPoolGateway slotPoolGateway =
setupSlotPool(slotPool, resourceManagerGateway);
-
slotPoolGateway.registerTaskManager(taskManagerLocation.getResourceID());
+ try (SlotPoolImpl newSlotPool = new SlotPoolImpl(jobId)) {
+ SlotPoolImpl slotPool = setupSlotPool(newSlotPool,
resourceManagerGateway, mainThreadExecutor);
Review comment:
The aliasing of `newSlotPool` with `slotPool` is a bit confusing. I think we
can change `setupSlotPool` to return `void`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services