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 02:54:54 UTC
svn commit: r1347235 - in /incubator/ambari/branches/ambari-186: CHANGES.txt
hmc/php/db/OrchestratorDB.php hmc/php/orchestrator/Cluster.php
hmc/php/orchestrator/ClusterMain.php hmc/php/orchestrator/Service.php
hmc/php/orchestrator/ServiceComponent.php
Author: vikram
Date: Thu Jun 7 00:54:53 2012
New Revision: 1347235
URL: http://svn.apache.org/viewvc?rev=1347235&view=rev
Log:
AMBARI-431. Fix orchestrator to use correct display names for descriptions of stages (Contributed by Hitesh)
Modified:
incubator/ambari/branches/ambari-186/CHANGES.txt
incubator/ambari/branches/ambari-186/hmc/php/db/OrchestratorDB.php
incubator/ambari/branches/ambari-186/hmc/php/orchestrator/Cluster.php
incubator/ambari/branches/ambari-186/hmc/php/orchestrator/ClusterMain.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=1347235&r1=1347234&r2=1347235&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/CHANGES.txt (original)
+++ incubator/ambari/branches/ambari-186/CHANGES.txt Thu Jun 7 00:54:53 2012
@@ -6,6 +6,8 @@ characters wide.
Release 0.1.x - unreleased
+ AMBARI-431. Fix orchestrator to use correct display names for descriptions of stages (Hitesh via Vikram)
+
AMBARI-430. set service state to failed if cluster monitoring reconfiguration fails (Hitesh via Vikram)
AMBARI-429. Fix bug with jmx parsing on HBase. (Mahadev via Vikram)
Modified: incubator/ambari/branches/ambari-186/hmc/php/db/OrchestratorDB.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/php/db/OrchestratorDB.php?rev=1347235&r1=1347234&r2=1347235&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/php/db/OrchestratorDB.php (original)
+++ incubator/ambari/branches/ambari-186/hmc/php/db/OrchestratorDB.php Thu Jun 7 00:54:53 2012
@@ -46,6 +46,10 @@ class OrchestratorDB {
private $serviceComponentsCache;
+ private $serviceMetaInfo;
+
+ private $serviceComponentMetaInfo;
+
/**
* Initialize ODB
* @param string $dbPath
@@ -59,9 +63,47 @@ class OrchestratorDB {
$this->exploreMode = false;
$this->servicesCache = array();
$this->serviceComponentsCache = array();
+ $this->serviceMetaInfo = NULL;
+ $this->serviceComponentMetaInfo = NULL;
$this->logger = new HMCLogger("OrchestratorDB");
}
+ function getServiceDisplayName($serviceName) {
+ if (!isset($serviceMetaInfo)
+ || $serviceMetaInfo == NULL) {
+ $result = $this->db->getAllServicesList();
+ if ($result["result"] != 0 || !isset($result["services"])) {
+ $this->logger->log_error("Failed to retrieve service meta info from DB"
+ . ", error=" . $result["error"]);
+ return $serviceName;
+ }
+ $serviceMetaInfo = $result["services"];
+ }
+ if (isset($serviceMetaInfo[$serviceName]["displayName"])
+ && $serviceMetaInfo[$serviceName]["displayName"] != "") {
+ return $serviceMetaInfo[$serviceName]["displayName"];
+ }
+ return $serviceName;
+ }
+
+ function getServiceComponentDisplayName($serviceName, $componentName) {
+ if (!isset($serviceComponentMetaInfo)
+ || $serviceComponentMetaInfo == NULL) {
+ $result = $this->db->getAllServiceComponentsList();
+ if ($result["result"] != 0 || !isset($result["services"])) {
+ $this->logger->log_error("Failed to retrieve service component meta info from DB"
+ . ", error=" . $result["error"]);
+ return $componentName;
+ }
+ $serviceComponentMetaInfo = $result["services"];
+ }
+ if (isset($serviceComponentMetaInfo[$serviceName]["components"][$componentName]["displayName"])
+ && $serviceComponentMetaInfo[$serviceName]["components"][$componentName]["displayName"] != "") {
+ return $serviceComponentMetaInfo[$serviceName]["components"][$componentName]["displayName"];
+ }
+ return $componentName;
+ }
+
/**
* Get all the services in the cluster.
* @return array of Service objects
@@ -588,7 +630,9 @@ class OrchestratorDB {
$service = $this->servicesCache[$serviceName];
$this->logger->log_debug("Got cached service for $serviceName");
} else {
- $service = new Service($this->clusterName, $serviceName, $serviceState, $db, $puppet);
+ $displayName = $this->getServiceDisplayName($serviceName);
+ $service = new Service($this->clusterName, $serviceName, $serviceState,
+ $db, $puppet, $displayName);
$this->servicesCache[$serviceName] = $service;
$this->logger->log_debug("Did not get cached service for $serviceName");
}
@@ -602,9 +646,11 @@ class OrchestratorDB {
$serviceComponent = $this->serviceComponentsCache[$componentName];
$this->logger->log_debug("Got cached serviceComponent for $componentName");
} else {
+ $displayName = $this->getServiceComponentDisplayName($serviceName,
+ $componentName);
$serviceComponent =
new ServiceComponent($this->clusterName, $componentName, $serviceName,
- $componentState, $db, $puppet, $isClient);
+ $componentState, $db, $puppet, $isClient, $displayName);
$this->logger->log_debug("Did not get cached serviceComponent for $componentName");
$this->serviceComponentsCache[$componentName] = $serviceComponent;
}
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=1347235&r1=1347234&r2=1347235&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/php/orchestrator/Cluster.php (original)
+++ incubator/ambari/branches/ambari-186/hmc/php/orchestrator/Cluster.php Thu Jun 7 00:54:53 2012
@@ -397,7 +397,7 @@ class Cluster {
private function _installNodes($transaction, $hostCompMapping, $dryRun) {
$this->logger->log_info("Installing on nodes dryRun=" . $dryRun);
- $this->currentAction = "InstallNodes";
+ $this->currentAction = "Install Nodes";
$hostsToInstall = array();
$allHosts = array();
$compMapping = array();
@@ -483,7 +483,7 @@ class Cluster {
private function _startNodes($transaction, $hostCompMapping, $dryRun) {
$this->logger->log_info("Starting nodes dryRun=" . $dryRun);
- $this->currentAction = "StartNodes";
+ $this->currentAction = "Start Nodes";
$hostsToStart = array();
$kickHosts = array();
$noOpHosts = array();
Modified: incubator/ambari/branches/ambari-186/hmc/php/orchestrator/ClusterMain.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/php/orchestrator/ClusterMain.php?rev=1347235&r1=1347234&r2=1347235&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/php/orchestrator/ClusterMain.php (original)
+++ incubator/ambari/branches/ambari-186/hmc/php/orchestrator/ClusterMain.php Thu Jun 7 00:54:53 2012
@@ -178,7 +178,7 @@ function createServiceObj($dbHandle, $cl
continue;
}
$svcObj = new Service($svc["serviceName"], $svc["state"],
- $odb, $puppetInvoker);
+ $odb, $puppetInvoker, $svc["serviceName"]);
return $svcObj;
}
$logger->log_error("Could not find service in DB"
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=1347235&r1=1347234&r2=1347235&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/php/orchestrator/Service.php (original)
+++ incubator/ambari/branches/ambari-186/hmc/php/orchestrator/Service.php Thu Jun 7 00:54:53 2012
@@ -33,6 +33,9 @@ class Service {
// Name of the service
public $name;
+ // Display Name of the service
+ public $displayName;
+
// Service state
public $state;
@@ -68,8 +71,9 @@ class Service {
private $runClientSmokeTest;
function __construct($clusterName, $serviceName, $serviceState,
- $odb, $puppet) {
+ $odb, $puppet, $displayName) {
$this->name = $serviceName;
+ $this->displayName = $displayName;
$this->state = $serviceState;
$this->clusterName = $clusterName;
$this->db = $odb;
@@ -91,11 +95,11 @@ class Service {
function setState($state, $transaction, $dryRun, $persistTxn) {
if ($persistTxn) {
$txnProgress = getTransactionProgressFromState($state);
-// $desc = $this->name."-".$this->currentAction."-". TransactionProgress::$PROGRESS[$txnProgress];
- $desc = getActionDescription($this->name, $this->currentAction, TransactionProgress::$PROGRESS[$txnProgress]);
+ $desc = getActionDescription($this->displayName, $this->currentAction,
+ TransactionProgress::$PROGRESS[$txnProgress]);
if ($dryRun) {
-// $desc = $this->name."-".$this->currentAction."-PENDING";
- $desc = getActionDescription($this->name, $this->currentAction, "PENDING");
+ $desc = getActionDescription($this->displayName, $this->currentAction,
+ "PENDING");
}
$result =
$this->db->persistTransaction($transaction, State::$STATE[$state],
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=1347235&r1=1347234&r2=1347235&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/php/orchestrator/ServiceComponent.php (original)
+++ incubator/ambari/branches/ambari-186/hmc/php/orchestrator/ServiceComponent.php Thu Jun 7 00:54:53 2012
@@ -29,6 +29,9 @@ class ServiceComponent {
// Name of the component
public $name;
+ // Display Name of the component
+ public $displayName;
+
// Name of the service to which the component belongs to
public $serviceName;
@@ -60,9 +63,10 @@ class ServiceComponent {
private $currentAction;
function __construct($clusterName, $componentName, $serviceName, $componentState,
- $db, $puppet, $isClient) {
+ $db, $puppet, $isClient, $displayName) {
$this->clusterName = $clusterName;
$this->name = $componentName;
+ $this->displayName = $displayName;
$this->serviceName = $serviceName;
$this->state = $componentState;
$this->db = $db;
@@ -83,10 +87,11 @@ class ServiceComponent {
function setState($state, $transaction, $dryRun, $persistTxn) {
if ($persistTxn) {
$txnProgress = getTransactionProgressFromState($state);
- $desc = $this->name."-".$this->currentAction."-"
- . TransactionProgress::$PROGRESS[$txnProgress];
+ $desc = getActionDescription($this->displayName, $this->currentAction,
+ TransactionProgress::$PROGRESS[$txnProgress]);
if ($dryRun) {
- $desc = $this->name."-".$this->currentAction."-PENDING";
+ $desc = getActionDescription($this->displayName, $this->currentAction,
+ "PENDING");
}
$result = $this->db->persistTransaction($transaction, State::$STATE[$state],
$desc, TransactionProgress::$PROGRESS[$txnProgress],