[
https://issues.apache.org/jira/browse/FLINK-5856?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15894409#comment-15894409
]
ASF GitHub Bot commented on FLINK-5856:
---------------------------------------
Github user tillrohrmann commented on a diff in the pull request:
https://github.com/apache/flink/pull/3398#discussion_r104153768
--- 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;
--- End diff --
Please don't use `continue`. Better using `if {} else {}`.
> Need return redundant containers to yarn for yarn mode
> ------------------------------------------------------
>
> Key: FLINK-5856
> URL: https://issues.apache.org/jira/browse/FLINK-5856
> Project: Flink
> Issue Type: Bug
> Components: YARN
> Reporter: shuai.xu
> Assignee: shuai.xu
> Labels: flip-6
>
> In flip6, for flink on yarn mode, RM requests container from yarn according
> to the requirement of the JM. But the AMRMClientAsync used in yarn doesn't
> guarantee that the number of containers returned exactly equal to the number
> requested. So it need to record the number request by flink rm and return the
> redundant ones to yarn.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)