zhuzhurk commented on a change in pull request #10048:
[FLINK-14462][coordination] Remove JobGraph#allowQueuedScheduling flag because
it is always true
URL: https://github.com/apache/flink/pull/10048#discussion_r341514961
##########
File path:
flink-runtime/src/test/java/org/apache/flink/runtime/executiongraph/ExecutionGraphRestartTest.java
##########
@@ -632,52 +629,6 @@ public void
testRestartWithEagerSchedulingAndSlotSharing() throws Exception {
}
}
- @Test
- public void testRestartWithSlotSharingAndNotEnoughResources() throws
Exception {
Review comment:
Sorry for figuring out it late. But I think the simplest way to make it work
is to use `SimpleSlotProvider`, given that we are testing the `ExecutionGraph`
but not `SchedulerImp` here.
`SimpleSlotProvider` will fail immediately with a
`NoResourceAvailableException` if there is not enough resources. We can set the
slot num to be parallelism - 1 when constructing `SimpleSlotProvider` to keep
the same behavior of the tests.
Here's a sample for the change:
` @Test
public void testRestartWithSlotSharingAndNotEnoughResources() throws
Exception {
final int numRestarts = 10;
final int parallelism = 20;
final SlotSharingGroup sharingGroup = new SlotSharingGroup();
final JobVertex source = new JobVertex("source");
source.setInvokableClass(NoOpInvokable.class);
source.setParallelism(parallelism);
source.setSlotSharingGroup(sharingGroup);
final JobVertex sink = new JobVertex("sink");
sink.setInvokableClass(NoOpInvokable.class);
sink.setParallelism(parallelism);
sink.setSlotSharingGroup(sharingGroup);
sink.connectNewDataSetAsInput(source,
DistributionPattern.POINTWISE, ResultPartitionType.PIPELINED_BOUNDED);
TestRestartStrategy restartStrategy =
new TestRestartStrategy(numRestarts, false);
final ExecutionGraph eg = new
ExecutionGraphTestUtils.TestingExecutionGraphBuilder(TEST_JOB_ID, source, sink)
.setSlotProvider(new SimpleSlotProvider(TEST_JOB_ID,
parallelism - 1))
.setRestartStrategy(restartStrategy)
.setScheduleMode(ScheduleMode.EAGER)
.build();
eg.start(mainThreadExecutor);
eg.scheduleForExecution();
// the last suppressed restart is also counted
assertEquals(numRestarts + 1, eg.getNumberOfRestarts());
assertEquals(JobStatus.FAILED, eg.getState());
final Throwable t = eg.getFailureCause();
if (!(t instanceof NoResourceAvailableException)) {
ExceptionUtils.rethrowException(t, t.getMessage());
}
}`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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