You are viewing a plain text version of this content. The canonical link for it is here.
Posted to yarn-issues@hadoop.apache.org by "MENG DING (JIRA)" <ji...@apache.org> on 2015/11/03 16:59:27 UTC

[jira] [Updated] (YARN-1509) Make AMRMClient support send increase container request and get increased/decreased containers

     [ https://issues.apache.org/jira/browse/YARN-1509?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

MENG DING updated YARN-1509:
----------------------------
    Attachment: YARN-1509.9.patch

Thanks [~jianhe] for reviewing the patch and giving feedback offline. To summarize, in the following function:

{code: title=AMRMClientImpl.java}
+  protected void removePendingChangeRequests(
+      List<Container> changedContainers, boolean isIncrease) {
+    for (Container changedContainer : changedContainers) {
+      ContainerId containerId = changedContainer.getId();
+      if (pendingChange.get(containerId) == null) {
+        continue;
+      }
+      Resource target = pendingChange.get(containerId).getValue();
+      if (target == null) {
+        continue;
+      }
+      Resource changed = changedContainer.getResource();
+      if (isIncrease) {
+        if (Resources.fitsIn(target, changed)) {
+          if (LOG.isDebugEnabled()) {
+            LOG.debug("RM has confirmed increased resource allocation for "
+                + "container " + containerId + ". Current resource allocation:"
+                + changed + ". Remove pending change request:"
+                + target);
+          }
+          pendingChange.remove(containerId);
+        }
+      } else {
+        if (Resources.fitsIn(changed, target)) {
+          if (LOG.isDebugEnabled()) {
+            LOG.debug("RM has confirmed decreased resource allocation for "
+                + "container " + containerId + ". Current resource allocation:"
+                + changed + ". Remove pending change request:"
+                + target);
+          }
+          pendingChange.remove(containerId);
+        }
+      }
+    }
+  }
{code}
* There is no need to check null for {{target}}, as under no circumstance will it become null.
* Better yet, there is even no need to compare {{changed}} with {{target}}. Because {{Resources.fitsIn(changed, target)}} will always be true for confirmed increase request, and same with {{Resources.fitsIn(changed, target)}} for confirmed decreased request. I added these checks originally to be defensive, but after all, there is really no need for them.

Attaching latest patch that addresses the above.

> Make AMRMClient support send increase container request and get increased/decreased containers
> ----------------------------------------------------------------------------------------------
>
>                 Key: YARN-1509
>                 URL: https://issues.apache.org/jira/browse/YARN-1509
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>          Components: resourcemanager
>            Reporter: Wangda Tan (No longer used)
>            Assignee: MENG DING
>         Attachments: YARN-1509.1.patch, YARN-1509.2.patch, YARN-1509.3.patch, YARN-1509.4.patch, YARN-1509.5.patch, YARN-1509.6.patch, YARN-1509.7.patch, YARN-1509.8.patch, YARN-1509.9.patch
>
>
> As described in YARN-1197, we need add API in AMRMClient to support
> 1) Add increase request
> 2) Can get successfully increased/decreased containers from RM



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)