XComp commented on code in PR #24238:
URL: https://github.com/apache/flink/pull/24238#discussion_r1472679937
##########
flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveSchedulerBuilder.java:
##########
Review Comment:
The comment in
`#testRequirementLowerBoundDecreaseAfterResourceScarcityBelowAvailableSlots` is
not true anymore because we're disabling the `#resourceTimeout` call entirely:
> // at this point we'd ideally check that the job is stuck in
WaitingForResources, but we
> // can't differentiate between waiting due to the minimum requirements not
being fulfilled
> // and the resource timeout not being elapsed
We could remove this comment and replace it with some like that:
```java
assertThat(scheduler.getState()).as("The scheduler should be stuck in
WaitingForResources state because of the available slots being lower than the
lower bound of the job's parallelism
range.").isInstanceOf(WaitingForResources.class);
```
##########
flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveSchedulerBuilder.java:
##########
@@ -117,6 +118,12 @@ public AdaptiveSchedulerBuilder setJobMasterConfiguration(
return this;
}
+ public AdaptiveSchedulerBuilder withConfigurationOverride(
Review Comment:
I'm not a fan to add this method in the production code just to please the
test code. Alternatively, we could do the following change to
`AdaptiveSchedulerTest`:
```diff
diff --git
a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveSchedulerTest.java
b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveSchedulerTest.java
index ee94abc152b..85f9f64fdf2 100644
---
a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveSchedulerTest.java
+++
b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveSchedulerTest.java
@@ -1214,15 +1214,12 @@ public class AdaptiveSchedulerTest {
JobResourceRequirements initialJobResourceRequirements =
createRequirementsWithEqualLowerAndUpperParallelism(PARALLELISM);
+ final Configuration configuration =
createConfigurationWithNoTimeouts();
+ // no additional resource will become available - no need to wait
+ configuration.set(JobManagerOptions.RESOURCE_WAIT_TIMEOUT,
Duration.ofMillis(1));
+
final AdaptiveScheduler scheduler =
- prepareSchedulerWithNoTimeouts(jobGraph,
declarativeSlotPool)
- .withConfigurationOverride(
- conf -> {
- conf.set(
-
JobManagerOptions.RESOURCE_WAIT_TIMEOUT,
- Duration.ofMillis(1));
- return conf;
- })
+ prepareScheduler(jobGraph, declarativeSlotPool,
configuration)
.setJobResourceRequirements(initialJobResourceRequirements)
.build();
@@ -1289,10 +1286,15 @@ public class AdaptiveSchedulerTest {
private AdaptiveSchedulerBuilder prepareSchedulerWithNoTimeouts(
JobGraph jobGraph, DeclarativeSlotPool declarativeSlotPool) {
+ return prepareScheduler(jobGraph, declarativeSlotPool,
createConfigurationWithNoTimeouts());
+ }
+
+ private AdaptiveSchedulerBuilder prepareScheduler(
+ JobGraph jobGraph, DeclarativeSlotPool declarativeSlotPool,
Configuration config) {
return new AdaptiveSchedulerBuilder(
jobGraph, singleThreadMainThreadExecutor,
EXECUTOR_RESOURCE.getExecutor())
.setDeclarativeSlotPool(declarativeSlotPool)
-
.setJobMasterConfiguration(createConfigurationWithNoTimeouts());
+ .setJobMasterConfiguration(config);
}
private AdaptiveScheduler createSchedulerWithNoTimeouts(
@@ -2086,9 +2088,7 @@ public class AdaptiveSchedulerTest {
configuration.set(JobManagerOptions.SCHEDULER_SCALING_INTERVAL_MAX,
scalingIntervalMax);
final AdaptiveScheduler scheduler =
- prepareSchedulerWithNoTimeouts(jobGraph,
declarativeSlotPool)
- .setJobMasterConfiguration(configuration)
- .build();
+ prepareScheduler(jobGraph, declarativeSlotPool,
configuration).build();
final SubmissionBufferingTaskManagerGateway taskManagerGateway =
new SubmissionBufferingTaskManagerGateway(PARALLELISM);
startJobWithSlotsMatchingParallelism(
```
WDYT?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]