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

Billie Rinaldi commented on SLIDER-1224:
----------------------------------------

[~kyungwan nam], thanks for the patch! This looks great, so I will close 
SLIDER-1104 as a duplicate of this. I took your test from SLIDER-1104 and 
expanded it a bit to test this patch, and I found one more thing that needs to 
be changed:
https://github.com/apache/incubator-slider/blob/develop/slider-core/src/main/java/org/apache/slider/server/appmaster/state/OutstandingRequestTracker.java#L179

The outcome is set to open when a request is found in openRequests. We should 
add a check here that says if the request mayEscalate and isEscalated, the 
outcome should be set to escalated. This is similar to what is done when a 
request is found in placedRequests, but the mayEscalate property needs to be 
checked as well.

Please also include the test in your patch:
{noformat}
diff --git 
a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/history/TestRoleHistoryOutstandingRequestTracker.groovy
 
b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/history/TestRoleHistoryOutstandingRequestTracker.groovy
index 7be01ad..574ded5 100644
--- 
a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/history/TestRoleHistoryOutstandingRequestTracker.groovy
+++ 
b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/history/TestRoleHistoryOutstandingRequestTracker.groovy
@@ -143,6 +143,52 @@ class TestRoleHistoryOutstandingRequestTracker extends 
BaseMockAppStateTest  {
   }
 
   @Test
+  public void testIssuedEscalatedRequest() throws Throwable {
+    def req1 = tracker.newRequest(host1, 0)
+    def resource = factory.newResource()
+    resource.virtualCores = 1
+    resource.memory = 48;
+    def yarnRequest = req1.buildContainerRequest(resource, role0Status, 0)
+    assert tracker.listPlacedRequests().size() == 1
+    assert tracker.listOpenRequests().size() == 0
+
+    tracker.escalateOutstandingRequests(role0Status.placementTimeoutSeconds * 
1000)
+    assert !req1.isEscalated()
+    assert tracker.listPlacedRequests().size() == 1
+    assert tracker.listOpenRequests().size() == 0
+
+    tracker.escalateOutstandingRequests(role0Status.placementTimeoutSeconds * 
1000 + 1)
+    assert req1.isEscalated()
+    assert tracker.listPlacedRequests().size() == 0
+    assert tracker.listOpenRequests().size() == 1
+
+    def c1 = factory.newContainer()
+
+    def nodeId = factory.newNodeId()
+    c1.nodeId = nodeId
+    // if request was escalated, container can be allocated to another host
+    // by relaxed placement.
+    nodeId.host = "host9"
+
+    def pri = ContainerPriority.buildPriority(0, false)
+    assert pri > 0
+    c1.setPriority(new MockPriority(pri))
+
+    c1.setResource(resource)
+
+    def issued = req1.issuedRequest
+    assert issued.capability == resource
+    assert issued.priority.priority == c1.getPriority().getPriority()
+    assert req1.resourceRequirementsMatch(resource)
+
+    def allocation = tracker.onContainerAllocated(0, nodeId.host, c1)
+    assert tracker.listPlacedRequests().size() == 0
+    assert tracker.listOpenRequests().size() == 0
+    assert allocation.outcome == ContainerAllocationOutcome.Escalated;
+    assert allocation.origin.is(req1)
+  }
+
+  @Test
   public void testResetEntries() throws Throwable {
     tracker.newRequest(host1, 0)
     tracker.newRequest(host2, 0)
{noformat}

> the outstanding request that has been escalated is failed to cleanup
> --------------------------------------------------------------------
>
>                 Key: SLIDER-1224
>                 URL: https://issues.apache.org/jira/browse/SLIDER-1224
>             Project: Slider
>          Issue Type: Bug
>    Affects Versions: Slider 0.92
>            Reporter: kyungwan nam
>            Assignee: kyungwan nam
>         Attachments: SLIDER-1224.001.patch
>
>
> There is a slider app with placement policy is normal ( 0 ).
> If an outstanding request is escalated, the container can be allocated to 
> another node, not desired node. 
> But, when container is allocated to another node, the outstanding request is 
> kept, not to remove
> I think it is the same issue with SLIDER-1104.
> it can still happen with slider-0.92.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to