You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by pa...@apache.org on 2018/01/12 18:20:48 UTC

[09/11] drill git commit: DRILL-6025: Display execution time of a query in RUNNING state

DRILL-6025: Display execution time of a query in RUNNING state

This closes #1074


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/fa2005ee
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/fa2005ee
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/fa2005ee

Branch: refs/heads/master
Commit: fa2005eebffe259324f3d91f6c31d0b52d59e434
Parents: 58f6b32
Author: Prasad Nagaraj Subramanya <pr...@gmail.com>
Authored: Thu Jan 11 07:14:52 2018 -0800
Committer: Parth Chandra <pa...@apache.org>
Committed: Thu Jan 11 17:18:50 2018 -0800

----------------------------------------------------------------------
 .../server/rest/profile/ProfileWrapper.java     | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/fa2005ee/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileWrapper.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileWrapper.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileWrapper.java
index 20cc0ca..d59b464 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileWrapper.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileWrapper.java
@@ -202,25 +202,33 @@ public class ProfileWrapper {
   }
 
   public String getExecutionDuration() {
-    //Check if State is PREPARING, PLANNING, STARTING, ENQUEUED or RUNNING
+    //Check if State is PREPARING, PLANNING, STARTING or ENQUEUED
     if (profile.getState() == QueryState.PREPARING ||
         profile.getState() == QueryState.PLANNING ||
         profile.getState() == QueryState.STARTING ||
-        profile.getState() == QueryState.ENQUEUED ||
-        profile.getState() == QueryState.RUNNING) {
+        profile.getState() == QueryState.ENQUEUED) {
       return NOT_AVAILABLE_LABEL;
     }
 
+    long queryEndTime;
+
+    // Check if State is RUNNING, set end time to current time
+    if (profile.getState() == QueryState.RUNNING) {
+      queryEndTime = System.currentTimeMillis();
+    } else {
+       queryEndTime = profile.getEnd();
+    }
+
     //Check if QueueEnd is known
     if (profile.getQueueWaitEnd() > 0L) {
       //Execution time [end(QueueWait) - endTime(Query)]
-      return (new SimpleDurationFormat(profile.getQueueWaitEnd(), profile.getEnd())).verbose();
+      return (new SimpleDurationFormat(profile.getQueueWaitEnd(), queryEndTime)).verbose();
     }
 
     //Check if Plan End is known
     if (profile.getPlanEnd() > 0L) {
       //Execution time [end(Planning) - endTime(Query)]
-      return (new SimpleDurationFormat(profile.getPlanEnd(), profile.getEnd())).verbose();
+      return (new SimpleDurationFormat(profile.getPlanEnd(), queryEndTime)).verbose();
     }
 
     //Check if any fragments have started
@@ -237,7 +245,7 @@ public class ProfileWrapper {
         }
       }
       //Execution time [start(rootFragment) - endTime(Query)]
-      return (new SimpleDurationFormat(estimatedPlanEnd, profile.getEnd())).verbose() + ESTIMATED_LABEL;
+      return (new SimpleDurationFormat(estimatedPlanEnd, queryEndTime)).verbose() + ESTIMATED_LABEL;
     }
 
     //Unable to  estimate/calculate Specific Execution Time