[ 
https://issues.apache.org/jira/browse/YARN-750?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13673496#comment-13673496
 ] 

Bikas Saha commented on YARN-750:
---------------------------------

Probably dont need the iterator
{code}
+  private void addBlacklistAdditionsToProto() {
+    maybeInitBuilder();
+    builder.clearBlacklistAdditions();
+    if (blacklistAdditions == null) {
+      return;
+    }
+    Iterable<String> iterable = new Iterable<String>() {
+      @Override
+      public Iterator<String> iterator() {
+        return new Iterator<String>() {
+
+          Iterator<String> iter = blacklistAdditions.iterator();
+
+          @Override
+          public boolean hasNext() {
+            return iter.hasNext();
+          }
+
+          @Override
+          public String next() {
+            return iter.next();
+          }
+
+          @Override
+          public void remove() {
+            throw new UnsupportedOperationException();
+
+          }
+        };
+
+      }
+    };
{code}

The null should probably clear the internal list also.
{code}
+  @Override
+  public void setBlacklistAdditions(List<String> resourceNames) {
+    if (blacklistAdditions == null) {
+      return;
+    }
+    initBlacklistAdditions();
+    this.blacklistAdditions.clear();
+    if (resourceNames != null) {
+      this.blacklistAdditions.addAll(resourceNames);
+    }
+  }
{code}

Please check with [~sseth]. build() is probably required for immutable records.
{code}
+  @Override
+  protected void build() {
+    proto = builder.build();
+    builder = null;
+  }
+}
{code}

Looks like the javadoc has gotten mixed up
{code}
+/**
+ * The exception is thrown when the requested resource is out of the range
+ * of the configured lower and upper resource boundaries.
+ *
+ */
+public class InvalidBlacklistRequestException extends YarnException {
.....
 /**
- * The exception is thrown when the requested resource is out of the range
- * of the configured lower and upper resource boundaries.
- *
+ * The exception is thrown when an application tries to blacklist
+ * {@link ResourceRequest#ANY}.
  */
 public class InvalidResourceRequestException extends YarnException {
{code}

This and a couple of others like this should probably not be null.
{code}
         // Update application requests
-        application.updateResourceRequests(ask);
+        application.updateResourceRequests(ask, null);
{code}

Changes for Fair Scheduler?
                
> Allow for black-listing resources in CS
> ---------------------------------------
>
>                 Key: YARN-750
>                 URL: https://issues.apache.org/jira/browse/YARN-750
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>            Reporter: Arun C Murthy
>            Assignee: Arun C Murthy
>         Attachments: YARN-750.patch
>
>
> YARN-392 and YARN-398 enhance scheduler api to allow for white-lists of 
> resources.
> This jira is a companion to allow for black-listing (in CS).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to