incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tbeerbo...@apache.org
Subject [1/3] git commit: AMBARI-3583 - Requests API should rollup tasks information
Date Tue, 29 Oct 2013 14:58:35 GMT
Updated Branches:
  refs/heads/trunk d57d5f794 -> c7f1fed4b


AMBARI-3583 - Requests API should rollup tasks information


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

Branch: refs/heads/trunk
Commit: c7f1fed4b864e2fd9d5d385c848580df7f9199f3
Parents: 8b0fc1c
Author: tbeerbower <tbeerbower@hortonworks.com>
Authored: Mon Oct 28 17:12:03 2013 -0400
Committer: tbeerbower <tbeerbower@hortonworks.com>
Committed: Tue Oct 29 10:58:08 2013 -0400

----------------------------------------------------------------------
 .../server/controller/internal/RequestResourceProvider.java      | 2 +-
 .../server/controller/internal/RequestResourceProviderTest.java  | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/c7f1fed4/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestResourceProvider.java
index 7452b75..b6b03b4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestResourceProvider.java
@@ -248,7 +248,7 @@ class RequestResourceProvider extends AbstractControllerResourceProvider
{
                                    completedTaskCount == taskCount ? HostRoleStatus.COMPLETED
:
                                                                      HostRoleStatus.PENDING;
     double progressPercent =
-        (queuedTaskCount * 0.09 + inProgressTaskCount * 0.35 + completedTaskCount / (double)
taskCount) * 100.0;
+        ((queuedTaskCount * 0.09 + inProgressTaskCount * 0.35 + completedTaskCount)/(double)
taskCount) * 100.0;
 
     setResourceProperty(resource, REQUEST_STATUS_PROPERTY_ID, requestStatus.toString(), requestedPropertyIds);
     setResourceProperty(resource, REQUEST_TASK_CNT_ID, taskCount, requestedPropertyIds);

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/c7f1fed4/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestResourceProviderTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestResourceProviderTest.java
index 80d34e7..a613a0e 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestResourceProviderTest.java
@@ -359,10 +359,10 @@ public class RequestResourceProviderTest {
 
       if (id == 100L) {
         Assert.assertEquals(1, resource.getPropertyValue(RequestResourceProvider.REQUEST_COMPLETED_TASK_CNT_ID));
-        Assert.assertEquals(85.0, resource.getPropertyValue(RequestResourceProvider.REQUEST_PROGRESS_PERCENT_ID));
+        Assert.assertEquals(67.5, resource.getPropertyValue(RequestResourceProvider.REQUEST_PROGRESS_PERCENT_ID));
       } else {
         Assert.assertEquals(0, resource.getPropertyValue(RequestResourceProvider.REQUEST_COMPLETED_TASK_CNT_ID));
-        Assert.assertEquals(43.99999999999999, resource.getPropertyValue(RequestResourceProvider.REQUEST_PROGRESS_PERCENT_ID));
+        Assert.assertEquals(21.999999999999996, resource.getPropertyValue(RequestResourceProvider.REQUEST_PROGRESS_PERCENT_ID));
       }
     }
 


Mime
View raw message