You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ji...@apache.org on 2012/05/29 22:46:30 UTC

svn commit: r1343972 - in /incubator/ambari/branches/ambari-186: CHANGES.txt hmc/php/util/suggestProperties.php hmc/tests/php/util/testSuggestProperties.php

Author: jitendra
Date: Tue May 29 20:46:30 2012
New Revision: 1343972

URL: http://svn.apache.org/viewvc?rev=1343972&view=rev
Log:
AMBARI-306. Ignore client components when calculating memory. Contributed by Hitesh.

Modified:
    incubator/ambari/branches/ambari-186/CHANGES.txt
    incubator/ambari/branches/ambari-186/hmc/php/util/suggestProperties.php
    incubator/ambari/branches/ambari-186/hmc/tests/php/util/testSuggestProperties.php

Modified: incubator/ambari/branches/ambari-186/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/CHANGES.txt?rev=1343972&r1=1343971&r2=1343972&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/CHANGES.txt (original)
+++ incubator/ambari/branches/ambari-186/CHANGES.txt Tue May 29 20:46:30 2012
@@ -6,6 +6,8 @@ characters wide.
 
 Release 0.1.x - unreleased
 
+  AMBARI-306. Ignore client components when calculating memory. (hitesh via jitendra)
+
   AMBARI-305. Combine Hive and HCat into a single service. (hitesh via jitendra)
 
   AMBARI-278. Update MapReduce parameter configuration description. (suresh via jitendra)

Modified: incubator/ambari/branches/ambari-186/hmc/php/util/suggestProperties.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/php/util/suggestProperties.php?rev=1343972&r1=1343971&r2=1343972&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/php/util/suggestProperties.php (original)
+++ incubator/ambari/branches/ambari-186/hmc/php/util/suggestProperties.php Tue May 29 20:46:30 2012
@@ -170,6 +170,40 @@ class SuggestProperties {
       $result["error"] = $allHostsToComponents["error"];
       return $result;
     }
+
+
+    // filter host roles for client-only components
+    $ignoredComponents = array();
+
+    $allComponents = $db->getAllServiceComponentsList();
+    if ($allComponents["result"] == 0) {
+      if (isset($allComponents["services"])
+          && is_array($allComponents["services"])) {
+        foreach ($allComponents["services"] as $svcName => $svcInfo) {
+          if (isset($svcInfo["components"])
+              && is_array($svcInfo["components"])) {
+            foreach ($svcInfo["components"] as $compName => $compInfo) {
+              if (isset($compInfo["isClient"]) && $compInfo["isClient"]) {
+                $ignoredComponents[$compName] = TRUE;
+              } else if ($compName == "GANGLIA_MONITOR") {
+                $ignoredComponents[$compName] = TRUE;
+              }
+            }
+          }
+        }
+      }
+    }
+
+    foreach ($allHostsToComponents["hosts"] as $hostName => $compList) {
+      $newComps = array();
+      foreach ($compList["components"] as $compName) {
+        if (!isset($ignoredComponents[$compName])) {
+          array_push($newComps, $compName);
+        }
+      }
+      $allHostsToComponents["hosts"][$hostName]["components"] = $newComps;
+    }
+
     $result["configs"] = array();
 
     // set the num map/reduce tasks

Modified: incubator/ambari/branches/ambari-186/hmc/tests/php/util/testSuggestProperties.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/tests/php/util/testSuggestProperties.php?rev=1343972&r1=1343971&r2=1343972&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/tests/php/util/testSuggestProperties.php (original)
+++ incubator/ambari/branches/ambari-186/hmc/tests/php/util/testSuggestProperties.php Tue May 29 20:46:30 2012
@@ -1,11 +1,13 @@
 <?php
 
-include_once '../util/Logger.php';
-include_once '../conf/Config.inc';
-include_once "../util/lock.php";
-include_once '../db/HMCDBAccessor.php';
 
-include_once "SuggestProperties.php";
+
+include_once '../../../php/util/Logger.php';
+include_once '../../../php/conf/Config.inc';
+include_once "../../../php/util/lock.php";
+include_once '../../../php/db/HMCDBAccessor.php';
+
+include_once "../../../php/util/SuggestProperties.php";
 
 $GLOBALS["HMC_LOG_LEVEL"] = HMCLogger::DEBUG;
 $GLOBALS["HMC_LOG_FILE"] = "./hmc.log";
@@ -41,7 +43,7 @@ array (
         "osType" => "RHEL5",
         "os" => "RHEL5 32-bit",
         "disksInfo" => "foo",
-        "discoveryStatus" => "success",
+        "discoveryStatus" => "SUCCESS",
         "badHealthReason" => "no error"
 ),
 array (
@@ -53,7 +55,7 @@ array (
         "osType" => "RHEL6",
         "os" => "RHEL6 64-bit",
         "disksInfo" => "bar",
-        "discoveryStatus" => "success",
+        "discoveryStatus" => "SUCCESS",
         "badHealthReason" => "no error"
 ),
 array (
@@ -65,7 +67,7 @@ array (
         "osType" => "RHEL6",
         "os" => "RHEL6 64-bit",
         "disksInfo" => "bar",
-        "discoveryStatus" => "success",
+        "discoveryStatus" => "SUCCESS",
         "badHealthReason" => "no error"
 ),
 array (
@@ -77,7 +79,7 @@ array (
         "osType" => "RHEL6",
         "os" => "RHEL6 64-bit",
         "disksInfo" => "bar",
-        "discoveryStatus" => "success",
+        "discoveryStatus" => "SUCCESS",
         "badHealthReason" => "no error"
 ),
 array (
@@ -89,7 +91,7 @@ array (
         "osType" => "RHEL6",
         "os" => "RHEL6 64-bit",
         "disksInfo" => "bar",
-        "discoveryStatus" => "success",
+        "discoveryStatus" => "SUCCESS",
         "badHealthReason" => "no error"
 )
 );
@@ -241,8 +243,8 @@ $configs = $result["properties"];
 
 $result = $suggestProperties->verifyProperties($clusterName, $db, $configs);
 assert(is_array($result));
-assert($result["result"] == 0);
-assert($result["error"] == "");
+assert($result["result"] != 0);
+assert($result["error"] != "");
 assert(is_array($result["cfgErrors"]));
 assert(is_array($result["cfgWarnings"]));