Skip to content

Commit 981117b

Browse files
authored
ODP-2211 | YARN-9921 : Fix LLAP node labelling issue (#29)
1 parent 0b93676 commit 981117b

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/SchedulingRequestPBImpl.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,27 @@ public boolean equals(Object other) {
277277
if (other == null) {
278278
return false;
279279
}
280-
if (other.getClass().isAssignableFrom(this.getClass())) {
281-
return this.getProto().equals(this.getClass().cast(other).getProto());
280+
if (other instanceof SchedulingRequest) {
281+
if (this == other) {
282+
return true;
283+
}
284+
SchedulingRequest that = (SchedulingRequest) other;
285+
if (getAllocationRequestId() != that.getAllocationRequestId()) {
286+
return false;
287+
}
288+
if (!getAllocationTags().equals(that.getAllocationTags())) {
289+
return false;
290+
}
291+
if (!getPriority().equals(that.getPriority())) {
292+
return false;
293+
}
294+
if(!getExecutionType().equals(that.getExecutionType())) {
295+
return false;
296+
}
297+
if(!getResourceSizing().equals(that.getResourceSizing())) {
298+
return false;
299+
}
300+
return getPlacementConstraint().equals(that.getPlacementConstraint());
282301
}
283302
return false;
284303
}

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,22 @@ public void testSchedulingRequestUpdate() {
226226
schedulingRequest.getResourceSizing().setNumAllocations(10);
227227
allocator.updatePendingAsk(schedulerRequestKey, schedulingRequest, false);
228228

229+
// Update allocator with a newly constructed scheduling request different at
230+
// #allocations, should succeeded.
231+
SchedulingRequest newSchedulingRequest =
232+
SchedulingRequest.newBuilder().executionType(
233+
ExecutionTypeRequest.newInstance(ExecutionType.GUARANTEED))
234+
.allocationRequestId(10L).priority(Priority.newInstance(1))
235+
.placementConstraintExpression(PlacementConstraints
236+
.targetNotIn(PlacementConstraints.NODE,
237+
PlacementConstraints.PlacementTargets.nodePartition(""),
238+
PlacementConstraints.PlacementTargets
239+
.allocationTag("mapper", "reducer"))
240+
.build()).resourceSizing(
241+
ResourceSizing.newInstance(11, Resource.newInstance(1024, 1)))
242+
.build();
243+
allocator.updatePendingAsk(schedulerRequestKey, newSchedulingRequest, false);
244+
229245
// Update allocator with scheduling request different at resource,
230246
// should failed.
231247
schedulingRequest.getResourceSizing().setResources(

0 commit comments

Comments
 (0)