Github user chtyim commented on a diff in the pull request:

    https://github.com/apache/incubator-twill/pull/52#discussion_r34398840
  
    --- Diff: 
twill-yarn/src/main/java/org/apache/twill/internal/appmaster/RunningContainers.java
 ---
    @@ -179,35 +182,41 @@ ResourceReport getResourceReport() {
        * Stops and removes the last running container of the given runnable.
        */
       void removeLast(String runnableName) {
    +    int maxInstanceId = getMaxInstanceId(runnableName);
    +    if (maxInstanceId < 0) {
    +      LOG.warn("No running container found for {}", runnableName);
    +      return;
    +    }
    +    removeById(runnableName, maxInstanceId);
    +  }
    +
    +  /**
    +   * Stop and remove a container for a runnable on an id.
    +   */
    +  void removeById(String runnableName, int instanceId) {
         containerLock.lock();
         try {
    -      int maxInstanceId = getMaxInstanceId(runnableName);
    -      if (maxInstanceId < 0) {
    -        LOG.warn("No running container found for {}", runnableName);
    -        return;
    -      }
    -
    -      String lastContainerId = null;
    -      TwillContainerController lastController = null;
    +      String containerId = null;
    +      TwillContainerController controller = null;
     
           // Find the controller with the maxInstanceId
    --- End diff --
    
    in-line comment is no longer accurate.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to