xintongsong commented on a change in pull request #11353: [FLINK-16438][yarn]
Make YarnResourceManager starts workers using WorkerResourceSpec requested by
SlotManager
URL: https://github.com/apache/flink/pull/11353#discussion_r390740551
##########
File path:
flink-yarn/src/main/java/org/apache/flink/yarn/YarnResourceManager.java
##########
@@ -615,4 +632,85 @@ protected double getCpuCores(final Configuration
configuration) {
//noinspection NumericCastThatLosesPrecision
return cpuCoresLong;
}
+
+ /**
+ * Utility class for converting between Flink {@link
WorkerResourceSpec} and Yarn {@link Resource}.
+ */
+ @VisibleForTesting
+ static class WorkerSpecContainerResourceAdapter {
+ private final Configuration flinkConfig;
+ private final int minMemMB;
+ private final int minVcore;
+ private final boolean matchVcores;
+ private final Map<WorkerResourceSpec, Resource>
workerSpecToContainerResource;
+ private final Map<Resource, Collection<WorkerResourceSpec>>
containerResourceToWorkerSpecs;
+ private final Map<Integer, Collection<Resource>>
containerMemoryToContainerResource;
Review comment:
I think the upper bond of the amount of records really depends on how many
different `WorkerResourceSpec` do we have.
If we want to clean the unused records up, the
`WorkerSpecContainerResourceAdapter` will need `YarnResourceManager` to tell it
which `WorkerResourceSpec` is no longer needed (all corresponding TMs are
completed and no pending ones). ATM, I don't see the necessity for such
comlexity.
----------------------------------------------------------------
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