azagrebin commented on a change in pull request #10146: [FLINK-14188][runtime]
TaskExecutor derive and register with default slot resource profile
URL: https://github.com/apache/flink/pull/10146#discussion_r352156070
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/TaskExecutorResourceUtils.java
##########
@@ -622,7 +645,25 @@ private static TaskExecutorResourceSpec
createTaskExecutorResourceSpec(
flinkInternalMemory.onHeapManaged,
flinkInternalMemory.offHeapManaged,
jvmMetaspaceAndOverhead.metaspace,
- jvmMetaspaceAndOverhead.overhead);
+ jvmMetaspaceAndOverhead.overhead,
+ getDefaultSlotFraction(config));
+ }
+
+ @SuppressWarnings("deprecation")
+ private static double getDefaultSlotFraction(final Configuration
config) {
+ if (config.contains(TaskManagerOptions.DEFAULT_SLOT_FRACTION)) {
+ final double fraction =
config.getDouble(TaskManagerOptions.DEFAULT_SLOT_FRACTION);
+ if (fraction <= 0.0 || fraction > 1.0) {
+ throw new IllegalArgumentException("Configured
default slot fraction (" + fraction + ") must be in the range of (0.0, 1.0].");
+ }
+ return fraction;
+ } else {
+ final int numOfSlots =
config.getInteger(TaskManagerOptions.NUM_TASK_SLOTS);
+ if (numOfSlots <= 0) {
+ throw new IllegalArgumentException("Configured
number of slots (" + numOfSlots + ") must greater than 0.");
Review comment:
`Preconditions.checkArgument``
----------------------------------------------------------------
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