tez-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jeag...@apache.org
Subject tez git commit: TEZ-3719. DAGImpl.computeProgress slows down dispatcher and ipc threads (Gopal V via jeagles)
Date Fri, 12 May 2017 15:09:02 GMT
Repository: tez
Updated Branches:
  refs/heads/branch-0.8 261fe92b2 -> 5a6139940


TEZ-3719. DAGImpl.computeProgress slows down dispatcher and ipc threads (Gopal V via jeagles)

(cherry picked from commit de21f990a06fcb304328df7a601789b348873739)


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

Branch: refs/heads/branch-0.8
Commit: 5a61399409c743c877f3a479d001e0bf292b217a
Parents: 261fe92
Author: Jonathan Eagles <jeagles@yahoo-inc.com>
Authored: Fri May 12 09:51:00 2017 -0500
Committer: Jonathan Eagles <jeagles@yahoo-inc.com>
Committed: Fri May 12 09:51:55 2017 -0500

----------------------------------------------------------------------
 .../apache/tez/dag/app/dag/impl/TaskImpl.java   | 15 ++++++---
 .../apache/tez/dag/app/dag/impl/VertexImpl.java | 33 ++++++++++++++++++--
 2 files changed, 41 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/5a613994/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TaskImpl.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TaskImpl.java b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TaskImpl.java
index 6bb14d5..04074af 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TaskImpl.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TaskImpl.java
@@ -476,11 +476,18 @@ public class TaskImpl implements Task, EventHandler<TaskEvent>
{
   public float getProgress() {
     readLock.lock();
     try {
-      TaskAttempt bestAttempt = selectBestAttempt();
-      if (bestAttempt == null) {
-        return 0f;
+      final TaskStateInternal state = getInternalState();
+      if (state == TaskStateInternal.RUNNING) {
+        TaskAttempt bestAttempt = selectBestAttempt();
+        if (bestAttempt == null) {
+          return 0f;
+        }
+        return bestAttempt.getProgress();
+      } else if (state == TaskStateInternal.SUCCEEDED) {
+        return 1.0f;
+      } else {
+        return 0.0f;
       }
-      return bestAttempt.getProgress();
     } finally {
       readLock.unlock();
     }

http://git-wip-us.apache.org/repos/asf/tez/blob/5a613994/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java
index daef85d..cc0eda0 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java
@@ -1337,7 +1337,30 @@ public class VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
EventHandl
   public float getProgress() {
     this.readLock.lock();
     try {
-      computeProgress();
+      final VertexState state = this.getState();
+      switch (state) {
+      case NEW:
+      case INITED:
+      case INITIALIZING:
+        progress = 0.0f;
+        break;
+      case RUNNING:
+        computeProgress();
+        break;
+      case KILLED:
+      case ERROR:
+      case FAILED:
+      case TERMINATING:
+        progress = 0.0f;
+        break;
+      case COMMITTING:
+      case SUCCEEDED:
+        progress = 1.0f;
+        break;
+      default:
+        // unknown, do not change progress
+        break;
+      }
       return progress;
     } finally {
       this.readLock.unlock();
@@ -1374,7 +1397,11 @@ public class VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
EventHandl
       ProgressBuilder progress = new ProgressBuilder();
       progress.setTotalTaskCount(numTasks);
       progress.setSucceededTaskCount(succeededTaskCount);
-      progress.setRunningTaskCount(getRunningTasks());
+      if (inTerminalState()) {
+        progress.setRunningTaskCount(0);
+      } else {
+        progress.setRunningTaskCount(getRunningTasks());
+      }
       progress.setFailedTaskCount(failedTaskCount);
       progress.setKilledTaskCount(killedTaskCount);
       progress.setFailedTaskAttemptCount(failedTaskAttemptCount.get());
@@ -1427,7 +1454,7 @@ public class VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
EventHandl
     try {
       float progress = 0f;
       for (Task task : this.tasks.values()) {
-        progress += (task.isFinished() ? 1f : task.getProgress());
+        progress += (task.getProgress());
       }
       if (this.numTasks != 0) {
         progress /= this.numTasks;


Mime
View raw message