goiri commented on a change in pull request #3754:
URL: https://github.com/apache/hadoop/pull/3754#discussion_r769934084



##########
File path: 
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ApplicationMasterService.java
##########
@@ -395,7 +397,23 @@ public AllocateResponse allocate(AllocateRequest request)
 
     ApplicationAttemptId appAttemptId =
         amrmTokenIdentifier.getApplicationAttemptId();
+    RMAppAttemptMetrics rmMetrics = getAppAttemptMetrics(appAttemptId);
+    // we do this here to prevent the internal lock in allocate()
+    if (rmMetrics != null) {
+      rmMetrics.setAllocateLatenciesTimestamps(request.getAskList());
+    }
+    AllocateResponse response = allocate(request, amrmTokenIdentifier);

Review comment:
       We may want to put the two `rmMetrics != null` together.
   No need to do the allocate in between, right?

##########
File path: 
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ApplicationMasterService.java
##########
@@ -472,6 +485,23 @@ public AllocateResponse allocate(AllocateRequest request)
     }
   }
 
+  protected RMAppAttemptMetrics getAppAttemptMetrics(
+      ApplicationAttemptId appAttemptId) {
+    if (appAttemptId == null) {
+      return null;
+    }
+    RMApp app = 
this.rmContext.getRMApps().get(appAttemptId.getApplicationId());

Review comment:
       This is still a little too long. Maybe better something like.
   ```
   apps = this.rmContext.getRMApps();
   ApplicationId appId = appAttemptId.getApplicationId();
   RMApp app = apps.get(appId);
   ```
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



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

Reply via email to