GJL commented on a change in pull request #6775: [FLINK-5542] use YarnCluster
vcores setting to do MaxVCore validation
URL: https://github.com/apache/flink/pull/6775#discussion_r223300816
##########
File path:
flink-yarn/src/main/java/org/apache/flink/yarn/AbstractYarnClusterDescriptor.java
##########
@@ -282,18 +282,29 @@ private void isReadyForDeployment(ClusterSpecification
clusterSpecification) thr
}
// Check if we don't exceed YARN's maximum virtual cores.
- // The number of cores can be configured in the config.
- // If not configured, it is set to the number of task slots
- int numYarnVcores =
yarnConfiguration.getInt(YarnConfiguration.NM_VCORES,
YarnConfiguration.DEFAULT_NM_VCORES);
+ // Fetch numYarnMaxVcores from all the RUNNING nodes via
yarnClient
+ int numYarnMaxVcores = Integer.MIN_VALUE;
Review comment:
How about:
```
final int numYarnMaxVcores;
try {
numYarnMaxVcores =
yarnClient.getNodeReports(NodeState.RUNNING)
.stream()
.mapToInt(report ->
report.getCapability().getVirtualCores())
.max()
.orElse(0);
} catch (Exception e) {
throw new YarnDeploymentException("Couldn't get cluster
description, please check on the YarnConfiguration", e);
}
```
?
Pros of doing so:
- `numYarnMaxVcores` is final
- If no NodeManagers are running at all, we would log `0` vcores instead of
`Integer.MIN_VALUE`
- Concise & easy to read
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services