This is an automated email from the ASF dual-hosted git repository.
ztang pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push:
new fd84ca5 YARN-9921. Issue in PlacementConstraint when YARN Service AM
retries allocation on component failure. Contributed by Tarun Parimi
fd84ca5 is described below
commit fd84ca5161d171f7e754b9b06623c6118e048066
Author: Zhankun Tang <[email protected]>
AuthorDate: Thu Oct 24 10:05:00 2019 +0800
YARN-9921. Issue in PlacementConstraint when YARN Service AM retries
allocation on component failure. Contributed by Tarun Parimi
---
.../records/impl/pb/SchedulingRequestPBImpl.java | 23 ++++++++++++++++++++--
.../TestSingleConstraintAppPlacementAllocator.java | 16 +++++++++++++++
2 files changed, 37 insertions(+), 2 deletions(-)
diff --git
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/SchedulingRequestPBImpl.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/SchedulingRequestPBImpl.java
index a53dca1..222ea63 100644
---
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/SchedulingRequestPBImpl.java
+++
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/SchedulingRequestPBImpl.java
@@ -277,8 +277,27 @@ public class SchedulingRequestPBImpl extends
SchedulingRequest {
if (other == null) {
return false;
}
- if (other.getClass().isAssignableFrom(this.getClass())) {
- return this.getProto().equals(this.getClass().cast(other).getProto());
+ if (other instanceof SchedulingRequest) {
+ if (this == other) {
+ return true;
+ }
+ SchedulingRequest that = (SchedulingRequest) other;
+ if (getAllocationRequestId() != that.getAllocationRequestId()) {
+ return false;
+ }
+ if (!getAllocationTags().equals(that.getAllocationTags())) {
+ return false;
+ }
+ if (!getPriority().equals(that.getPriority())) {
+ return false;
+ }
+ if(!getExecutionType().equals(that.getExecutionType())) {
+ return false;
+ }
+ if(!getResourceSizing().equals(that.getResourceSizing())) {
+ return false;
+ }
+ return getPlacementConstraint().equals(that.getPlacementConstraint());
}
return false;
}
diff --git
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/placement/TestSingleConstraintAppPlacementAllocator.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/placement/TestSingleConstraintAppPlacementAllocator.java
index e651831..d7fa600 100644
---
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/placement/TestSingleConstraintAppPlacementAllocator.java
+++
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/placement/TestSingleConstraintAppPlacementAllocator.java
@@ -226,6 +226,22 @@ public class TestSingleConstraintAppPlacementAllocator {
schedulingRequest.getResourceSizing().setNumAllocations(10);
allocator.updatePendingAsk(schedulerRequestKey, schedulingRequest, false);
+ // Update allocator with a newly constructed scheduling request different
at
+ // #allocations, should succeeded.
+ SchedulingRequest newSchedulingRequest =
+ SchedulingRequest.newBuilder().executionType(
+ ExecutionTypeRequest.newInstance(ExecutionType.GUARANTEED))
+ .allocationRequestId(10L).priority(Priority.newInstance(1))
+ .placementConstraintExpression(PlacementConstraints
+ .targetNotIn(PlacementConstraints.NODE,
+ PlacementConstraints.PlacementTargets.nodePartition(""),
+ PlacementConstraints.PlacementTargets
+ .allocationTag("mapper", "reducer"))
+ .build()).resourceSizing(
+ ResourceSizing.newInstance(11, Resource.newInstance(1024, 1)))
+ .build();
+ allocator.updatePendingAsk(schedulerRequestKey, newSchedulingRequest,
false);
+
// Update allocator with scheduling request different at resource,
// should failed.
schedulingRequest.getResourceSizing().setResources(
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]