[GitHub] TisonKun commented on a change in pull request #7303: [FLINK-10569] [tests] Get rid of Scheduler from valid tests

2019-01-17 Thread GitBox
TisonKun commented on a change in pull request #7303: [FLINK-10569] [tests] Get 
rid of Scheduler from valid tests
URL: https://github.com/apache/flink/pull/7303#discussion_r248781935
 
 

 ##
 File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/executiongraph/ExecutionGraphRestartTest.java
 ##
 @@ -155,21 +153,12 @@ public void testRestartAutomatically() throws Exception {
public void testCancelWhileRestarting() throws Exception {
// We want to manually control the restart and delay
RestartStrategy restartStrategy = new 
InfiniteDelayRestartStrategy();
-   Tuple2 executionGraphInstanceTuple = 
createExecutionGraph(restartStrategy);
-   ExecutionGraph executionGraph = executionGraphInstanceTuple.f0;
-   Instance instance = executionGraphInstanceTuple.f1;
 
-   // Kill the instance and wait for the job to restart
-   instance.markDead();
-
-   Deadline deadline = TestingUtils.TESTING_DURATION().fromNow();
-
-   while (deadline.hasTimeLeft() &&
-   executionGraph.getState() != 
JobStatus.RESTARTING) {
-
-   Thread.sleep(100);
-   }
+   SlotProvider slotProvider = new TestingSlotProvider(ignore -> 
new CompletableFuture<>());
+   ExecutionGraph executionGraph = 
createSimpleExecutionGraph(restartStrategy, slotProvider);
+   assertEquals(JobStatus.CREATED, executionGraph.getState());
 
+   executionGraph.scheduleForExecution();
assertEquals(JobStatus.RESTARTING, executionGraph.getState());
 
 Review comment:
   Sure.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] TisonKun commented on a change in pull request #7303: [FLINK-10569] [tests] Get rid of Scheduler from valid tests

2019-01-17 Thread GitBox
TisonKun commented on a change in pull request #7303: [FLINK-10569] [tests] Get 
rid of Scheduler from valid tests
URL: https://github.com/apache/flink/pull/7303#discussion_r248781777
 
 

 ##
 File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/executiongraph/VertexSlotSharingTest.java
 ##
 @@ -90,12 +90,12 @@ public void testAssignSlotSharingGroup() {
new SerializedValue<>(new ExecutionConfig()),
AkkaUtils.getDefaultTimeout(),
new NoRestartStrategy(),
-   new 
Scheduler(TestingUtils.defaultExecutionContext()));
+   new TestingSlotProvider(ignored -> new 
CompletableFuture<>()));
eg.attachJobGraph(vertices);

// verify that the vertices are all in the same slot 
sharing group
-   SlotSharingGroup group1 = null;
-   SlotSharingGroup group2 = null;
+   SlotSharingGroup group1;
 
 Review comment:
   Revert while rebasing.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] TisonKun commented on a change in pull request #7303: [FLINK-10569] [tests] Get rid of Scheduler from valid tests

2019-01-16 Thread GitBox
TisonKun commented on a change in pull request #7303: [FLINK-10569] [tests] Get 
rid of Scheduler from valid tests
URL: https://github.com/apache/flink/pull/7303#discussion_r248454800
 
 

 ##
 File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/executiongraph/ExecutionGraphRestartTest.java
 ##
 @@ -155,21 +153,12 @@ public void testRestartAutomatically() throws Exception {
public void testCancelWhileRestarting() throws Exception {
// We want to manually control the restart and delay
RestartStrategy restartStrategy = new 
InfiniteDelayRestartStrategy();
-   Tuple2 executionGraphInstanceTuple = 
createExecutionGraph(restartStrategy);
-   ExecutionGraph executionGraph = executionGraphInstanceTuple.f0;
-   Instance instance = executionGraphInstanceTuple.f1;
 
-   // Kill the instance and wait for the job to restart
-   instance.markDead();
-
-   Deadline deadline = TestingUtils.TESTING_DURATION().fromNow();
-
-   while (deadline.hasTimeLeft() &&
-   executionGraph.getState() != 
JobStatus.RESTARTING) {
-
-   Thread.sleep(100);
-   }
+   SlotProvider slotProvider = new TestingSlotProvider(ignore -> 
new CompletableFuture<>());
+   ExecutionGraph executionGraph = 
createSimpleExecutionGraph(restartStrategy, slotProvider);
+   assertEquals(JobStatus.CREATED, executionGraph.getState());
 
+   executionGraph.scheduleForExecution();
assertEquals(JobStatus.RESTARTING, executionGraph.getState());
 
 Review comment:
   This is because the SlotProvider returns non-completed future. And eg is 
configured as not allow queued scheduling. Thus when scheduleForExecutor, it 
causes `IllegalArgumentException("The slot allocation future has not been 
completed yet.")` and then failing and then restarting.
   
   But it is tricky. Maybe I should set allow queued scheduling and fail a 
future to emulate a real failure.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] TisonKun commented on a change in pull request #7303: [FLINK-10569] [tests] Get rid of Scheduler from valid tests

2019-01-16 Thread GitBox
TisonKun commented on a change in pull request #7303: [FLINK-10569] [tests] Get 
rid of Scheduler from valid tests
URL: https://github.com/apache/flink/pull/7303#discussion_r248449108
 
 

 ##
 File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/executiongraph/VertexSlotSharingTest.java
 ##
 @@ -90,12 +90,12 @@ public void testAssignSlotSharingGroup() {
new SerializedValue<>(new ExecutionConfig()),
AkkaUtils.getDefaultTimeout(),
new NoRestartStrategy(),
-   new 
Scheduler(TestingUtils.defaultExecutionContext()));
+   new TestingSlotProvider(ignored -> new 
CompletableFuture<>()));
eg.attachJobGraph(vertices);

// verify that the vertices are all in the same slot 
sharing group
-   SlotSharingGroup group1 = null;
-   SlotSharingGroup group2 = null;
+   SlotSharingGroup group1;
 
 Review comment:
   Gotcha.


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:
us...@infra.apache.org


With regards,
Apache Git Services