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

ASF GitHub Bot commented on YARN-11289:
---------------------------------------

slfan1989 commented on code in PR #4836:
URL: https://github.com/apache/hadoop/pull/4836#discussion_r961293032


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/amrmproxy/FederationInterceptor.java:
##########
@@ -770,18 +771,26 @@ public FinishApplicationMasterResponse 
finishApplicationMaster(
 
     if (failedToUnRegister) {
       homeResponse.setIsUnregistered(false);
-    } else {
+    } else if (checkRequestFinalApplicationStatusSuccess(request)) {
       // Clean up UAMs only when the app finishes successfully, so that no more
       // attempt will be launched.
       this.uamPool.stop();
-      if (this.registryClient != null) {
-        this.registryClient
-            .removeAppFromRegistry(this.attemptId.getApplicationId());
-      }
+      removeAppFromRegistry();
     }
     return homeResponse;
   }
 
+  private boolean 
checkRequestFinalApplicationStatusSuccess(FinishApplicationMasterRequest 
request) {
+    if (request == null) {
+      return false;
+    } else if(request.getFinalApplicationStatus() == null){

Review Comment:
   Thank you very much for helping to review the code, I will modify the code!



##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/amrmproxy/FederationInterceptor.java:
##########
@@ -770,18 +771,26 @@ public FinishApplicationMasterResponse 
finishApplicationMaster(
 
     if (failedToUnRegister) {
       homeResponse.setIsUnregistered(false);
-    } else {
+    } else if (checkRequestFinalApplicationStatusSuccess(request)) {
       // Clean up UAMs only when the app finishes successfully, so that no more
       // attempt will be launched.
       this.uamPool.stop();
-      if (this.registryClient != null) {
-        this.registryClient
-            .removeAppFromRegistry(this.attemptId.getApplicationId());
-      }
+      removeAppFromRegistry();
     }
     return homeResponse;
   }
 
+  private boolean 
checkRequestFinalApplicationStatusSuccess(FinishApplicationMasterRequest 
request) {
+    if (request == null) {
+      return false;
+    } else if(request.getFinalApplicationStatus() == null){

Review Comment:
   Thank you very much for helping to review the code, I will modify the code.





> [Federation] Improve NM FederationInterceptor removeAppFromRegistry
> -------------------------------------------------------------------
>
>                 Key: YARN-11289
>                 URL: https://issues.apache.org/jira/browse/YARN-11289
>             Project: Hadoop YARN
>          Issue Type: Improvement
>          Components: federation, nodemanager
>    Affects Versions: 3.4.0
>            Reporter: fanshilun
>            Assignee: fanshilun
>            Priority: Major
>              Labels: pull-request-available
>
> [Federation] Improve NM FederationInterceptor removeAppFromRegistry
> 1.FederationInterceptor#finishApplicationMaster needs to check 
> getFinalApplicationStatus, and clean up when the status is SUCCESS.
> 2. When FederationInterceptor#shutdown, perform CleanUp on Application.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to