You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by vi...@apache.org on 2012/06/07 00:54:12 UTC

svn commit: r1347195 - in /incubator/ambari/branches/ambari-186: CHANGES.txt hmc/php/db/HMCDBAccessor.php hmc/php/orchestrator/Cluster.php hmc/php/orchestrator/Service.php hmc/php/orchestrator/ServiceComponent.php

Author: vikram
Date: Wed Jun  6 22:54:12 2012
New Revision: 1347195

URL: http://svn.apache.org/viewvc?rev=1347195&view=rev
Log:
AMBARI-407. add more logging and timing info for various actions (Contributed by Hitesh)

Modified:
    incubator/ambari/branches/ambari-186/CHANGES.txt
    incubator/ambari/branches/ambari-186/hmc/php/db/HMCDBAccessor.php
    incubator/ambari/branches/ambari-186/hmc/php/orchestrator/Cluster.php
    incubator/ambari/branches/ambari-186/hmc/php/orchestrator/Service.php
    incubator/ambari/branches/ambari-186/hmc/php/orchestrator/ServiceComponent.php

Modified: incubator/ambari/branches/ambari-186/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/CHANGES.txt?rev=1347195&r1=1347194&r2=1347195&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/CHANGES.txt (original)
+++ incubator/ambari/branches/ambari-186/CHANGES.txt Wed Jun  6 22:54:12 2012
@@ -6,6 +6,8 @@ characters wide.
 
 Release 0.1.x - unreleased
 
+  AMBARI-407. add more logging and timing info for various actions (Hitesh via Vikram)
+
   AMBARI-406. Monitoring dashboard does not show ZK service state correctly (Ramya via Vikram)
 
   AMBARI-321. Multiple ZK nodes not displayed on review-page (Yusaku via Vikram)

Modified: incubator/ambari/branches/ambari-186/hmc/php/db/HMCDBAccessor.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/php/db/HMCDBAccessor.php?rev=1347195&r1=1347194&r2=1347195&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/php/db/HMCDBAccessor.php (original)
+++ incubator/ambari/branches/ambari-186/hmc/php/db/HMCDBAccessor.php Wed Jun  6 22:54:12 2012
@@ -77,7 +77,7 @@ class HMCDBAccessor {
     }
     LockRelease(); return $response;
   }
-  
+
   /**
    * Update cluster state for a given clusterName
    * @param string $clusterName Cluster Name
@@ -973,7 +973,7 @@ class HMCDBAccessor {
    *      )
    *   - optionally, an array of [ "sortColumn" => $sortColumn, "sortOrder" => $sortOrder]
    *     can be used
-   *      
+   *
    * @return mixed
    *   array (
    *       "result" => 0,
@@ -1055,7 +1055,7 @@ class HMCDBAccessor {
           }
           if (isset($orderItem["sortOrder"])) {
             $query .= " ".$orderItem["sortOrder"];
-            if (sizeof($order) > 0) { 
+            if (sizeof($order) > 0) {
               $query .= ',';
             }
           }
@@ -1526,8 +1526,24 @@ class HMCDBAccessor {
     LockAcquire();
     $response = array ( "result" => 0, "error" => "");
 
-    if (empty($hosts)) {
+    if ($hosts == NULL || empty($hosts)) {
       LockRelease(); return $response;
+    } else {
+      $noOp = TRUE;
+      foreach ($hosts as $host) {
+        if (isset($host)) {
+          $h = trim($host);
+          if ($h != "") {
+            $noOp = FALSE;
+            break;
+          }
+        }
+      }
+      if ($noOp) {
+        $this->logger->log_warn("Invalid hosts array passed in to function"
+            . ", hosts=" . implode(",", $hosts));
+        LockRelease(); return $response;
+      }
     }
 
     $error = "";

Modified: incubator/ambari/branches/ambari-186/hmc/php/orchestrator/Cluster.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/php/orchestrator/Cluster.php?rev=1347195&r1=1347194&r2=1347195&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/php/orchestrator/Cluster.php (original)
+++ incubator/ambari/branches/ambari-186/hmc/php/orchestrator/Cluster.php Wed Jun  6 22:54:12 2012
@@ -123,6 +123,11 @@ class Cluster {
       }
 
       $nodes = $result["nodes"];
+
+      $this->logger->log_debug("Kicking puppet for uninstalling "
+         . "cluster=" . $this->name
+         . ", txn=" . $transaction->toString());
+      $startTime = time();
       $result = $this->puppet->kickPuppet($nodes, $transaction, $this->name,
           $result["componentMapping"], array ("wipeoff_data" => $wipeoutFlag));
       $this->logger->log_debug("Puppet kick response for uninstalling "
@@ -130,11 +135,17 @@ class Cluster {
           . ", txn=" . $transaction->toString()
           . ", response=" . print_r($result, true));
       // handle puppet response
-      $opStatus = array( "nodeReport" =>
-          array ( "PUPPET_KICK_FAILED" => $result[KICKFAILED],
-            "PUPPET_OPERATION_FAILED" => $result[FAILEDNODES],
-            "PUPPET_OPERATION_TIMEDOUT" => $result[TIMEDOUTNODES],
-            "PUPPET_OPERATION_SUCCEEDED" => $result[SUCCESSFULLNODES]));
+      $timeTaken = time() - $startTime;
+      $opStatus = array(
+         "stats" =>
+            array (
+              "NODE_COUNT" => count($nodes),
+              "TIME_TAKEN_SECS" => $timeTaken),
+         "nodeReport" =>
+            array ( "PUPPET_KICK_FAILED" => $result[KICKFAILED],
+              "PUPPET_OPERATION_FAILED" => $result[FAILEDNODES],
+              "PUPPET_OPERATION_TIMEDOUT" => $result[TIMEDOUTNODES],
+              "PUPPET_OPERATION_SUCCEEDED" => $result[SUCCESSFULLNODES]));
 
       $this->logger->log_info("Persisting puppet report for uninstall HDP");
       $this->db->persistTransactionOpStatus($transaction,
@@ -409,16 +420,26 @@ class Cluster {
       $this->setState(State::INSTALLING, $transaction, $dryRun);
 
       // send kick to hosts
+      $this->logger->log_debug("Kicking puppet for installing nodes on "
+         . " cluster=" . $this->name
+         . ", txn=" . $transaction->toString());
+      $startTime = time();
       $result = $this->puppet->kickPuppet($allHosts, $transaction, $this->name,
           $compMapping);
-      $this->logger->log_debug("Puppet kick response for installing "
+      $this->logger->log_debug("Puppet kick response for installing nodes on"
           . " cluster=" . $this->name
           . ", txn=" . $transaction->toString()
           . ", response=" . print_r($result, true));
 
       // handle puppet response
-      $opStatus = array ( "nodeReport" =>
-          array ( "PUPPET_KICK_FAILED" => $result[KICKFAILED],
+      $timeTaken = time() - $startTime;
+      $opStatus = array(
+          "stats" =>
+             array (
+                    "NODE_COUNT" => count($nodes),
+                    "TIME_TAKEN_SECS" => $timeTaken),
+          "nodeReport" =>
+             array ( "PUPPET_KICK_FAILED" => $result[KICKFAILED],
                   "PUPPET_OPERATION_FAILED" => $result[FAILEDNODES],
                   "PUPPET_OPERATION_TIMEDOUT" => $result[TIMEDOUTNODES],
                   "PUPPET_OPERATION_SUCCEEDED" => $result[SUCCESSFULLNODES]));
@@ -495,16 +516,26 @@ class Cluster {
       $this->setState(State::STARTING, $transaction, $dryRun);
 
       // send kick to  hosts
+      $this->logger->log_debug("Kicking puppet for starting nodes on"
+          . " cluster=" . $this->name
+          . ", txn=" . $transaction->toString());
+      $startTime = time();
       $result = $this->puppet->kickPuppet($kickHosts, $transaction,
           $this->name, $compMapping);
-      $this->logger->log_debug("Puppet kick response for installing "
+      $this->logger->log_debug("Puppet kick response for starting nodes on"
           . " cluster=" . $this->name
           . ", txn=" . $transaction->toString()
           . ", response=" . print_r($result, true));
 
       // handle puppet response
-      $opStatus = array ( "nodeReport" =>
-          array ( "PUPPET_KICK_FAILED" => $result[KICKFAILED],
+      $timeTaken = time() - $startTime;
+      $opStatus = array(
+          "stats" =>
+              array (
+                    "NODE_COUNT" => count($nodes),
+                    "TIME_TAKEN_SECS" => $timeTaken),
+         "nodeReport" =>
+            array ( "PUPPET_KICK_FAILED" => $result[KICKFAILED],
                   "PUPPET_OPERATION_FAILED" => $result[FAILEDNODES],
                   "PUPPET_OPERATION_TIMEDOUT" => $result[TIMEDOUTNODES],
                   "PUPPET_OPERATION_SUCCEEDED" => $result[SUCCESSFULLNODES]));
@@ -589,16 +620,26 @@ class Cluster {
       }
 
       $nodes = $result["nodes"];
+      $this->logger->log_debug("Kicking puppet for installing"
+          . " cluster=" . $this->name
+          . ", txn=" . $transaction->toString());
+      $startTime = time();
       $result = $this->puppet->kickPuppet($nodes, $transaction, $this->name,
           $result["componentMapping"]);
-      $this->logger->log_debug("Puppet kick response for installing "
+      $this->logger->log_debug("Puppet kick response for installing"
           . " cluster=" . $this->name
           . ", txn=" . $transaction->toString()
           . ", response=" . print_r($result, true));
 
       // handle puppet response
-      $opStatus = array ( "nodeReport" =>
-            array ( "PUPPET_KICK_FAILED" => $result[KICKFAILED],
+      $timeTaken = time() - $startTime;
+      $opStatus = array(
+         "stats" =>
+             array (
+                    "NODE_COUNT" => count($nodes),
+                    "TIME_TAKEN_SECS" => $timeTaken),
+         "nodeReport" =>
+             array ( "PUPPET_KICK_FAILED" => $result[KICKFAILED],
                     "PUPPET_OPERATION_FAILED" => $result[FAILEDNODES],
                     "PUPPET_OPERATION_TIMEDOUT" => $result[TIMEDOUTNODES],
                     "PUPPET_OPERATION_SUCCEEDED" => $result[SUCCESSFULLNODES]));

Modified: incubator/ambari/branches/ambari-186/hmc/php/orchestrator/Service.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/php/orchestrator/Service.php?rev=1347195&r1=1347194&r2=1347195&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/php/orchestrator/Service.php (original)
+++ incubator/ambari/branches/ambari-186/hmc/php/orchestrator/Service.php Wed Jun  6 22:54:12 2012
@@ -430,12 +430,15 @@ class Service {
     }
 
     if (!$dryRun) {
+      $this->logger->log_debug("Kicking puppet for smoketesting service on "
+         . " cluster=" . $this->clusterName
+         . ", service=" . $this->name
+         . ", txn=" . $transaction->toString());
 
+      $startTime = time();
       $result =
-        $this->puppet->kickServiceCheck(
-            array($this->name => $clientNode), $transaction,
-            $this->clusterName
-            );
+        $this->puppet->kickServiceCheck( array($this->name => $clientNode),
+            $transaction, $this->clusterName);
 
       $this->logger->log_debug("Puppet kick response for smoketesting service on "
           . " cluster=" . $this->clusterName
@@ -444,8 +447,14 @@ class Service {
           . ", response=" . print_r($result, true));
 
       // handle puppet response
-      $opStatus = array ( "nodeReport" =>
-          array ( "PUPPET_KICK_FAILED" => $result[KICKFAILED],
+      $timeTaken = time() - $startTime;
+      $opStatus = array(
+          "stats" =>
+               array (
+                      "NODE_COUNT" => count($nodes),
+                      "TIME_TAKEN_SECS" => $timeTaken),
+          "nodeReport" =>
+              array ( "PUPPET_KICK_FAILED" => $result[KICKFAILED],
                   "PUPPET_OPERATION_FAILED" => $result[FAILEDNODES],
                   "PUPPET_OPERATION_SUCCEEDED" => $result[SUCCESSFULLNODES]));
 

Modified: incubator/ambari/branches/ambari-186/hmc/php/orchestrator/ServiceComponent.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/php/orchestrator/ServiceComponent.php?rev=1347195&r1=1347194&r2=1347195&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/php/orchestrator/ServiceComponent.php (original)
+++ incubator/ambari/branches/ambari-186/hmc/php/orchestrator/ServiceComponent.php Wed Jun  6 22:54:12 2012
@@ -234,6 +234,12 @@ class ServiceComponent {
     }
 
     if (!$dryRun) {
+      $this->logger->log_debug("Kicking puppet for starting component on "
+         . " cluster=" . $this->clusterName
+         . ", servicecomponent=" . $this->name
+         . ", txn=" . $transaction->toString());
+
+      $startTime = time();
       $result = $this->puppet->kickPuppet($nodes['nodes'], $transaction,
           $this->clusterName, array ( $this->name => $nodes['nodes'] ));
       $this->logger->log_debug("Puppet kick response for starting component on "
@@ -243,11 +249,17 @@ class ServiceComponent {
           . ", response=" . print_r($result, true));
 
       // handle puppet response
-      $opStatus = array ( "nodeReport" =>
-          array ( "PUPPET_KICK_FAILED" => $result[KICKFAILED],
-                  "PUPPET_OPERATION_FAILED" => $result[FAILEDNODES],
-                  "PUPPET_OPERATION_TIMEDOUT" => $result[TIMEDOUTNODES],
-                  "PUPPET_OPERATION_SUCCEEDED" => $result[SUCCESSFULLNODES]));
+      $timeTaken = time() - $startTime;
+      $opStatus = array(
+          "stats" =>
+              array (
+                     "NODE_COUNT" => count($nodes),
+                     "TIME_TAKEN_SECS" => $timeTaken),
+          "nodeReport" =>
+              array ( "PUPPET_KICK_FAILED" => $result[KICKFAILED],
+                      "PUPPET_OPERATION_FAILED" => $result[FAILEDNODES],
+                      "PUPPET_OPERATION_TIMEDOUT" => $result[TIMEDOUTNODES],
+                   "PUPPET_OPERATION_SUCCEEDED" => $result[SUCCESSFULLNODES]));
 
       $this->logger->log_info("Persisting puppet report for starting "
           . $this->name);
@@ -341,6 +353,12 @@ class ServiceComponent {
     }
 
     if (!$dryRun) {
+      $this->logger->log_debug("Kicking puppet for stopping component on"
+          . " cluster=" . $this->clusterName
+          . ", servicecomponent=" . $this->name
+          . ", txn=" . $transaction->toString());
+
+      $startTime = time();
       $result = $this->puppet->kickPuppet($nodes['nodes'], $transaction,
           $this->clusterName, array ( $this->name => $nodes['nodes'] ));
       $this->logger->log_debug("Puppet kick response for stopping component on"
@@ -350,11 +368,17 @@ class ServiceComponent {
           . ", response=" . print_r($result, true));
 
       // handle puppet response
-      $opStatus = array ( "nodeReport" =>
-           array ( "PUPPET_KICK_FAILED" => $result[KICKFAILED],
-                   "PUPPET_OPERATION_FAILED" => $result[FAILEDNODES],
-                   "PUPPET_OPERATION_TIMEDOUT" => $result[TIMEDOUTNODES],
-                   "PUPPET_OPERATION_SUCCEEDED" => $result[SUCCESSFULLNODES]));
+      $timeTaken = time() - $startTime;
+      $opStatus = array(
+          "stats" =>
+              array (
+                     "NODE_COUNT" => count($nodes),
+                     "TIME_TAKEN_SECS" => $timeTaken),
+          "nodeReport" =>
+              array ( "PUPPET_KICK_FAILED" => $result[KICKFAILED],
+                      "PUPPET_OPERATION_FAILED" => $result[FAILEDNODES],
+                      "PUPPET_OPERATION_TIMEDOUT" => $result[TIMEDOUTNODES],
+                      "PUPPET_OPERATION_SUCCEEDED" => $result[SUCCESSFULLNODES]));
 
       $this->logger->log_info("Persisting puppet report for stopping "
           . $this->name);