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
[ Full content available at: https://github.com/apache/flink/pull/6775 ]
This message was relayed via gitbox.apache.org for [email protected]