[ 
https://issues.apache.org/jira/browse/GOBBLIN-1823?focusedWorklogId=861445&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-861445
 ]

ASF GitHub Bot logged work on GOBBLIN-1823:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 10/May/23 23:53
            Start Date: 10/May/23 23:53
    Worklog Time Spent: 10m 
      Work Description: ZihanLi58 commented on code in PR #3692:
URL: https://github.com/apache/gobblin/pull/3692#discussion_r1190484077


##########
gobblin-yarn/src/main/java/org/apache/gobblin/yarn/YarnService.java:
##########
@@ -473,6 +475,17 @@ public synchronized boolean 
requestTargetNumberOfContainers(YarnContainerRequest
       return false;
     }
 
+    //Correct the containerMap first as there is cases that 
handleContainerCompletion() is called before onContainersAllocated()
+    for (ContainerId removedId :this.removedContainerID.keySet()) {
+      ContainerInfo containerInfo = this.containerMap.remove(removedId);
+      if (containerInfo != null) {
+        String helixTag = containerInfo.getHelixTag();
+        allocatedContainerCountMap.putIfAbsent(helixTag, new AtomicInteger(0));
+        this.allocatedContainerCountMap.get(helixTag).decrementAndGet();

Review Comment:
   I don't think we will put it though because in this case, 
onContainerAllocated should have already been called and we definitely have one 
entry in the map. The worst case is if we call onContainerAllocated and this 
method concurrently, then we might end up decreasing the value and then 
increasing it immediately. 





Issue Time Tracking
-------------------

    Worklog Id:     (was: 861445)
    Time Spent: 50m  (was: 40m)

> Improving Container Calculation and Allocation Methodology
> ----------------------------------------------------------
>
>                 Key: GOBBLIN-1823
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-1823
>             Project: Apache Gobblin
>          Issue Type: Improvement
>            Reporter: Zihan Li
>            Priority: Major
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> When Yarn allocates "ghost containers" without calling the 
> onContainerAllocated() method and when the container is eventually released, 
> onContainersCompleted() is called, container numbers mismatches can occur. 
> In the onContainerAllocated() method, we add the container to the 
> containerMap using the container ID as the key, and increase the count for 
> the specific tag.
> In the onContainersCompleted() method, we remove the container from the 
> containerMap and decrease the count. However, in some cases, we find that the 
> containerMap does not contain the ID, and we ignore this while still 
> decreasing the number of the allocated tag. We do this because sometimes 
> onContainersCompleted() is called before onContainerAllocated() for the same 
> container.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to