pvary commented on a change in pull request #633: HIVE-21740: Collect LLAP 
execution latency metrics
URL: https://github.com/apache/hive/pull/633#discussion_r289320836
 
 

 ##########
 File path: 
llap-tez/src/java/org/apache/hadoop/hive/llap/tezplugins/LlapTaskSchedulerService.java
 ##########
 @@ -3154,4 +3160,22 @@ public void taskInfoUpdated(TezTaskAttemptID attemptId, 
boolean isGuaranteed) {
         + attemptId + ", " + newState);
     sendUpdateMessageAsync(ti, newState);
   }
+
+  private void updateMetrics(TaskAttemptImpl taskAttempt) {
+    // Only do it for successful map tasks
+    if (!TaskAttemptState.SUCCEEDED.equals(taskAttempt.getState()) || 
!isMapTask(taskAttempt)) {
+      return;
+    }
+    // Check if this task was already assigned to a node
+    NodeInfo nodeInfo = knownTasks.get(taskAttempt).assignedNode;
+    if (nodeInfo == null) {
+      return;
+    }
+
+    metrics.addTaskLatency(nodeInfo.shortStringBase, 
taskAttempt.getFinishTime() - taskAttempt.getLaunchTime());
+  }
+
+  private boolean isMapTask(TaskAttemptImpl taskAttempt) {
 
 Review comment:
   I am not yet entirely familiar with this part of the code.
   I thought that the vertex can tell us more but getVertex is package private 
method for TaskAttemptImp, and getting the Vertex from would need something 
like this (found in getTransitiveVertexOutputs):
   
   ------------------
   DagInfo info = getContext().getCurrentDagInfo();
   if (!(info instanceof DAG)) {
     LOG.warn("DAG info is not a DAG");
     return;
   }
   DAG dag = (DAG) info;
   Vertex vertex = dag.getVertex(taskAttempt.getVertexID());
   
   ------------------
   I found casting DagInfo to DAG more shady than relying on counters, but feel 
free to disagree.
   Also open to any suggestions where should I dig around more to find a better 
solution!

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to