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_r350307968
##########
File path:
flink-mesos/src/main/java/org/apache/flink/mesos/runtime/clusterframework/MesosTaskManagerParameters.java
##########
@@ -336,20 +336,22 @@ public String toString() {
public static MesosTaskManagerParameters create(Configuration
flinkConfig) {
List<ConstraintEvaluator> constraints =
parseConstraints(flinkConfig.getString(MESOS_CONSTRAINTS_HARD_HOSTATTR));
+
+ int numberOfSlot = flinkConfig.getInteger(MESOS_RM_TASKS_SLOTS);
+
+ double cpus = flinkConfig.getDouble(MESOS_RM_TASKS_CPUS);
+ if (cpus <= 0.0) {
+ cpus = Math.max(numberOfSlot, 1.0);
+ }
+
MemorySize totalProcessMemory =
MemorySize.parse(flinkConfig.getInteger(MESOS_RM_TASKS_MEMORY_MB) + "m");
- TaskExecutorResourceSpec taskExecutorResourceSpec =
-
TaskExecutorResourceUtils.resourceSpecFromConfig(flinkConfig,
totalProcessMemory);
+ TaskExecutorResourceSpec taskExecutorResourceSpec =
TaskExecutorResourceUtils.resourceSpecFromConfig(flinkConfig, cpus,
totalProcessMemory);
Review comment:
I mean these lines could go into a helper function e.g.
`createTaskExecutorResourceSpec`:
```
int numberOfSlot = flinkConfig.getInteger(MESOS_RM_TASKS_SLOTS);
double cpus =
flinkConfig.getDouble(TaskManagerOptions.CPU_CORES);
if (cpus <= 0.0) {
flinkConfig.getDouble(MESOS_RM_TASKS_CPUS);
}
if (cpus <= 0.0) {
cpus = Math.max(numberOfSlot, 1.0);
}
MemorySize totalProcessMemory =
MemorySize.parse(flinkConfig.getInteger(MESOS_RM_TASKS_MEMORY_MB) + "m");
TaskExecutorResourceSpec taskExecutorResourceSpec =
TaskExecutorResourceSpecBuilder
.newBuilder(flinkConfig)
.withCpuCores(cpus)
.withTotalProcessMemory(totalProcessMemory)
.build();
```
I meant testing that `MesosTaskManagerParameters` contains correct CPU
depending on `TaskManagerOptions.CPU_CORES` if it is not covered yet.
----------------------------------------------------------------
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