You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by st...@apache.org on 2014/06/30 17:37:34 UTC
[45/50] [abbrv] git commit: SLIDER-173 relaxLocality should be false
if specific node is requested
SLIDER-173 relaxLocality should be false if specific node is requested
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/590cbe02
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/590cbe02
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/590cbe02
Branch: refs/heads/feature/SLIDER-151_Implement_full_slider_API_in_REST_and_switch_client_to_it
Commit: 590cbe02a805362242657f1c3be3b60fe0ab7825
Parents: ea251f1
Author: tedyu <yu...@gmail.com>
Authored: Thu Jun 26 19:23:35 2014 -0700
Committer: tedyu <yu...@gmail.com>
Committed: Thu Jun 26 19:23:35 2014 -0700
----------------------------------------------------------------------
.../slider/server/appmaster/state/ContainerPriority.java | 8 ++++++--
.../slider/server/appmaster/state/OutstandingRequest.java | 7 ++-----
.../appmaster/model/appstate/TestMockRMOperations.groovy | 2 +-
3 files changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/590cbe02/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ContainerPriority.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ContainerPriority.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ContainerPriority.java
index ccd9a64..935c09f 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ContainerPriority.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ContainerPriority.java
@@ -37,9 +37,13 @@ import org.apache.hadoop.yarn.util.Records;
*/
public final class ContainerPriority {
+ // bit that represents whether location is specified
+ static final int LOCATION = 1 << 30;
+
public static int buildPriority(int role,
boolean locationSpecified) {
- return (role) ;
+ int location = locationSpecified ? LOCATION : 0;
+ return role | LOCATION;
}
@@ -53,7 +57,7 @@ public final class ContainerPriority {
public static int extractRole(int priority) {
- return priority ;
+ return priority >= LOCATION ? priority^LOCATION : priority;
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/590cbe02/slider-core/src/main/java/org/apache/slider/server/appmaster/state/OutstandingRequest.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/OutstandingRequest.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/OutstandingRequest.java
index 7d3e427..0d8b56c 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/OutstandingRequest.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/OutstandingRequest.java
@@ -103,23 +103,20 @@ public final class OutstandingRequest {
RoleStatus role, long time) {
String[] hosts;
boolean relaxLocality;
- boolean locationSpecified;
requestedTime = time;
if (node != null) {
hosts = new String[1];
hosts[0] = node.hostname;
- relaxLocality = true;
- locationSpecified = true;
+ relaxLocality = false;
// tell the node it is in play
node.getOrCreate(roleId);
log.info("Submitting request for container on {}", hosts[0]);
} else {
hosts = null;
relaxLocality = true;
- locationSpecified = false;
}
Priority pri = ContainerPriority.createPriority(roleId,
- locationSpecified);
+ !relaxLocality);
AMRMClient.ContainerRequest request =
new AMRMClient.ContainerRequest(resource,
hosts,
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/590cbe02/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockRMOperations.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockRMOperations.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockRMOperations.groovy
index 7f92f9c..168ac9f 100644
--- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockRMOperations.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockRMOperations.groovy
@@ -41,7 +41,7 @@ class TestMockRMOperations extends BaseMockAppStateTest implements MockRoles {
@Test
public void testPriorityOnly() throws Throwable {
- assert 5 == buildPriority(5, false)
+ assert 5 == extractRole(buildPriority(5, false))
}
@Test