Github user tillrohrmann commented on a diff in the pull request:
https://github.com/apache/flink/pull/3398#discussion_r104153900
--- Diff:
flink-yarn/src/main/java/org/apache/flink/yarn/YarnResourceManager.java ---
@@ -239,10 +245,26 @@ public void
onContainersCompleted(List<ContainerStatus> list) {
@Override
public void onContainersAllocated(List<Container> containers) {
for (Container container : containers) {
- numPendingContainerRequests = Math.max(0,
numPendingContainerRequests - 1);
- LOG.info("Received new container: {} - Remaining
pending container requests: {}",
- container.getId(),
numPendingContainerRequests);
+ Priority priority = container.getPriority();
+ // Yarn api say that it may give containers more than
asked, so release the redundant ones
+ if
(!numPendingContainerRequests.containsKey(priority.getPriority()) ||
+
numPendingContainerRequests.get(priority.getPriority()) <= 0) {
+ LOG.debug("Received more than asked containers,
will release the {}, priority {}",
+ container.getId(),
priority.getPriority());
+
resourceManagerClient.releaseAssignedContainer(container.getId());
+ continue;
+ }
+ int orgNum =
numPendingContainerRequests.get(priority.getPriority());
+ numPendingContainerRequests.put(priority.getPriority(),
orgNum - 1);
+ LOG.info("Received new container: {} for priority: {} -
Remaining pending container requests: {}",
+ container.getId(),
priority.getPriority(), orgNum - 1);
+
try {
+ // Yarn will not clear the request automaticly,
+ // And the resource allocated may not equal to
the resource requested
+ resourceManagerClient.removeContainerRequest(
--- End diff --
Why is that the case? How did it work before if Yarn does not clear the
container requests? Please elaborate a little bit how it worked before and why
it had to be changed.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---