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:30:23 UTC

svn commit: r1347181 - in /incubator/ambari/branches/ambari-186: CHANGES.txt hmc/db/schema.dump hmc/js/configureServices.js hmc/js/configureServicesUtils.js hmc/js/manageServices.js

Author: vikram
Date: Wed Jun  6 22:30:22 2012
New Revision: 1347181

URL: http://svn.apache.org/viewvc?rev=1347181&view=rev
Log:
AMBARI-325. MR vmem config options are useless without an option to enable/disable memory-monitoring (Contributed by Vinod)

Modified:
    incubator/ambari/branches/ambari-186/CHANGES.txt
    incubator/ambari/branches/ambari-186/hmc/db/schema.dump
    incubator/ambari/branches/ambari-186/hmc/js/configureServices.js
    incubator/ambari/branches/ambari-186/hmc/js/configureServicesUtils.js
    incubator/ambari/branches/ambari-186/hmc/js/manageServices.js

Modified: incubator/ambari/branches/ambari-186/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/CHANGES.txt?rev=1347181&r1=1347180&r2=1347181&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/CHANGES.txt (original)
+++ incubator/ambari/branches/ambari-186/CHANGES.txt Wed Jun  6 22:30:22 2012
@@ -6,6 +6,8 @@ characters wide.
 
 Release 0.1.x - unreleased
 
+  AMBARI-325. MR vmem config options are useless without an option to enable/disable memory-monitoring (Vinod via Vikram)
+
   AMBARI-402. Completing successful add node takes one to initialize cluster page starting from scratch (Varun via Vikram)
 
   AMBARI-401. Manual config changes for nn get reset on stop/start from hmc (Jitendra via Vikram)

Modified: incubator/ambari/branches/ambari-186/hmc/db/schema.dump
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/db/schema.dump?rev=1347181&r1=1347180&r2=1347181&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/db/schema.dump (original)
+++ incubator/ambari/branches/ambari-186/hmc/db/schema.dump Wed Jun  6 22:30:22 2012
@@ -288,23 +288,26 @@ INSERT OR REPLACE INTO "ConfigProperties
 -- maps to mapred_red_tasks_max in gscluster.
 INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "mapred_red_tasks_max", "2", "Number of Reduce slots per node", "Number of slots that Reduce tasks that run simultaneously can occupy on a TaskTracker.", "MAPREDUCE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text", "unit":"" }' );
 
+-- doesn't map to anything. Introduced for convenience purposes.
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "mapred_cluster_memory_scheduling_enabled", "checked", "Enable memory-based scheduling/monitoring?", "To enable memory based scheduling/monitoring or not", "MAPREDUCE" , "ONOFF", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "ONOFF", "unit":"", "isMetaProperty": "true", "childConfigsOnMetaPropEnabled": "[ \"mapred_cluster_map_mem_mb\", \"mapred_cluster_red_mem_mb\", \"mapred_cluster_max_map_mem_mb\", \"mapred_cluster_max_red_mem_mb\", \"mapred_job_map_mem_mb\", \"mapred_job_red_mem_mb\" ]", "childConfigsOnMetaPropDisabled": "[]" }' );
+
 -- maps to mapred_cluster_map_mem_mb in gscluster.
-INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "mapred_cluster_map_mem_mb", "-1", "Cluster's Map slot size (virtual memory)", "The virtual memory size of a single Map slot in the MapReduce framework", "MAPREDUCE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text", "unit":"MB" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "mapred_cluster_map_mem_mb", "-1", "Cluster's Map slot size (virtual memory)", "The virtual memory size of a single Map slot in the MapReduce framework", "MAPREDUCE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text", "unit":"MB", "metaProperty": "mapred_cluster_memory_scheduling_enabled" }' );
 
 -- maps to mapred_cluster_red_mem_mb in gscluster.
-INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "mapred_cluster_red_mem_mb", "-1", "Cluster's Reduce slot size (virtual memory)", "The virtual memory size of a single Reduce slot in the MapReduce framework", "MAPREDUCE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text", "unit":"MB" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "mapred_cluster_red_mem_mb", "-1", "Cluster's Reduce slot size (virtual memory)", "The virtual memory size of a single Reduce slot in the MapReduce framework", "MAPREDUCE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text", "unit":"MB", "metaProperty": "mapred_cluster_memory_scheduling_enabled" }' );
 
 -- maps to mapred_cluster_max_map_mem_mb in gscluster.
-INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "mapred_cluster_max_map_mem_mb", "-1", "Upper limit on virtual memory for single Map task", "Upper limit on virtual memory size for a single Map task of any MapReduce job", "MAPREDUCE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text", "unit":"MB" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "mapred_cluster_max_map_mem_mb", "-1", "Upper limit on virtual memory for single Map task", "Upper limit on virtual memory size for a single Map task of any MapReduce job", "MAPREDUCE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text", "unit":"MB", "metaProperty": "mapred_cluster_memory_scheduling_enabled" }' );
 
 -- maps to mapred_cluster_max_red_mem_mb in gscluster.
-INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "mapred_cluster_max_red_mem_mb", "-1", "Upper limit on virtual memory for single Reduce task", "Upper limit on virtual memory size for a single Reduce task of any MapReduce job", "MAPREDUCE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text", "unit":"MB" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "mapred_cluster_max_red_mem_mb", "-1", "Upper limit on virtual memory for single Reduce task", "Upper limit on virtual memory size for a single Reduce task of any MapReduce job", "MAPREDUCE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text", "unit":"MB", "metaProperty": "mapred_cluster_memory_scheduling_enabled" }' );
 
 -- maps to mapred_job_map_mem_mb in gscluster.
-INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "mapred_job_map_mem_mb", "-1", "Default virtual memory for a job's map-task", "Virtual memory for single Map task", "MAPREDUCE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text", "unit":"MB" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "mapred_job_map_mem_mb", "-1", "Default virtual memory for a job's map-task", "Virtual memory for single Map task", "MAPREDUCE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text", "unit":"MB", "metaProperty": "mapred_cluster_memory_scheduling_enabled" }' );
 
 -- maps to mapred_job_map_red_mb in gscluster.
-INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "mapred_job_red_mem_mb", "-1", "Default virtual memory for a job's reduce-task", "Virtual memory for single Reduce task", "MAPREDUCE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text", "unit":"MB" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "mapred_job_red_mem_mb", "-1", "Default virtual memory for a job's reduce-task", "Virtual memory for single Reduce task", "MAPREDUCE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text", "unit":"MB", "metaProperty": "mapred_cluster_memory_scheduling_enabled" }' );
 
 -- maps to mapred_child_java_opts_sz in gscluster in MB.
 INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "mapred_child_java_opts_sz", "768", "Java options for MapReduce tasks", "Java options for the TaskTracker child processes.", "MAPREDUCE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text", "unit":"MB" }' );

Modified: incubator/ambari/branches/ambari-186/hmc/js/configureServices.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/js/configureServices.js?rev=1347181&r1=1347180&r2=1347181&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/js/configureServices.js (original)
+++ incubator/ambari/branches/ambari-186/hmc/js/configureServices.js Wed Jun  6 22:30:22 2012
@@ -40,6 +40,7 @@ function renderConfigureServicesInternal
   var optionsSummary = constructDOM(optionsInfo);
  
   globalYui.one("#configureClusterAdvancedDynamicRenderDivId").setContent( optionsSummary );
+  postDOMRendering(optionsInfo);
   hideLoadingImg();
   globalYui.one("#configureClusterAdvancedCoreDivId").setStyle("display", "block");
 }

Modified: incubator/ambari/branches/ambari-186/hmc/js/configureServicesUtils.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/js/configureServicesUtils.js?rev=1347181&r1=1347180&r2=1347181&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/js/configureServicesUtils.js (original)
+++ incubator/ambari/branches/ambari-186/hmc/js/configureServicesUtils.js Wed Jun  6 22:30:22 2012
@@ -3,32 +3,81 @@
 
 var globalPasswordsArray = [];
 
-function generateDivForService (option, type, service, property, unit, displayAttributes) {
-	
+var globalOptionsInfo = null;
+
+function setRenderingForNestedProps(service, property, isMetaPropEnabled) {
+  var displayAttributes = globalOptionsInfo['services'][service]['properties'][property]['displayAttributes'];
+
+  var styleForEnabledConfigs = 'block';
+  var styleForDisabledConfigs = 'none';
+  if (!isMetaPropEnabled) {
+    styleForEnabledConfigs = 'none';
+    styleForDisabledConfigs = 'block';
+  }
+
+  var configsWhenItIsEnabled = globalYui.JSON.parse(displayAttributes.childConfigsOnMetaPropEnabled);
+  for (index in configsWhenItIsEnabled) {
+    globalYui.one('#' + configsWhenItIsEnabled[index]).setStyle('display', styleForEnabledConfigs);
+  }
+
+  var configsWhenItIsDisabled = globalYui.JSON.parse(displayAttributes.childConfigsOnMetaPropDisabled);
+  for (index in configsWhenItIsDisabled) {
+    globalYui.one('#' + configsWhenItIsDisabled[index]).setStyle('display', styleForDisabledConfigs);
+  }
+}
+
+function generateDivForService (optionsInfo, service, property, renderLevel) {
+
+//  globalYui.log(" === for " + service + "." + property );
+	var option = optionsInfo['services'][service]["properties"][property];
+
+  var type = convertDisplayType(optionsInfo['services'][service]['properties'][property]['type']);
+  if (type == "NODISPLAY") {
+    return '';
+  }
+
+  var displayAttributes = null;
+  if (optionsInfo['services'][service]['properties'][property]['displayAttributes']) {
+    displayAttributes = optionsInfo['services'][service]['properties'][property]['displayAttributes'];
+  }
+
+  var unit = optionsInfo['services'][service]['properties'][property]['unit'];
   var unitString = (unit != null) ? unit : '';
+
   var readOnlyFlag= false;
   if (displayAttributes != null && displayAttributes.editable != null
       && !displayAttributes.editable) {
     readOnlyFlag = true;
   }
 
-  var retString = '<div class="formElement">' +
+  var divId = property;
+  if (displayAttributes != null && displayAttributes.hasOwnProperty("isMetaProperty") && displayAttributes["isMetaProperty"] == "true") {
+    divId = 'formElement-' + service + '-' + property;
+  }
+
+  var retString = '<div class="formElement" id="' + divId + '">' +
     '<label for="' + service + '">' + option['displayName'] + '</label>' +
     //((unitString != '') ? '<div class="input-append">' : '') +
-    '<input class="unit-' + unit + '" type="' + type + '" id="' + property + '" name="' + service + '" value="' + option['value'] + '"';
+    '<input class="unit-' + unit + '" type="' + type + '" id="' + divId + '" name="' + service + '" value="' + option['value'] + '"';
   if (readOnlyFlag) {
     retString += ' readonly="readonly" ';
   }
 
+  if ( option.type == 'ONOFF') {
+    if ( option.value == "checked") {
+      retString += ' checked=true';
+    }
+  }
+
   retString += '> ' + unitString +
     '<div class="contextualHelp">' + option['description'] + '</div>' +
     //((unitString != '') ? '</div>' : '') +
     '<div class="formInputErrorReason" id="' + property + 'ErrorReason' + '"></div>' +
     '</div>';
   if (type == "password") {
-    retString += '<div class="formElement">' +
+    retString += '<div class="formElement" id="' + divId + '">' +
       '<label for="' + service + '"> Retype ' + option['displayName'] + '</label>' +
-      '<input type="' + type + '" id="' + property + 'SecretService" name="' + service + '" value="' + option['value'] + '">' +
+      '<input type="' + type + '" id="' + divId + 'SecretService" name="' + service + '" value="' + option['value'] + '">' +
       '<div class="contextualHelp">' + option['description'] + '</div>' +
       '<div class="formInputErrorReason" id="' + property + 'SecretServiceErrorReason' + '" ></div>' +
       '</div>';
@@ -41,9 +90,68 @@ function generateDivForService (option, 
     globalYui.log("Global Passwords Array: " + globalYui.Lang.dump(globalPasswordsArray));
 
   }
+
+  if (displayAttributes != null) {
+    if(displayAttributes.hasOwnProperty("isMetaProperty") && displayAttributes["isMetaProperty"] == "true") {
+
+      // This is a meta-property
+      var metaPropsRetString = retString;
+
+      var configsWhenItIsEnabled = globalYui.JSON.parse(displayAttributes.childConfigsOnMetaPropEnabled);
+      for (index in configsWhenItIsEnabled) {
+        metaPropsRetString += generateDivForService(optionsInfo, service, configsWhenItIsEnabled[index], 2);
+      }
+
+      var configsWhenItIsDisabled = globalYui.JSON.parse(displayAttributes.childConfigsOnMetaPropDisabled);
+      for (index in configsWhenItIsDisabled) {
+        metaPropsRetString += generateDivForService(optionsInfo, service, configsWhenItIsEnabled[index], 2);
+      }
+
+      return metaPropsRetString;
+    } else if (renderLevel == 1 && displayAttributes.hasOwnProperty("metaProperty")) {
+      // This is not a top-level property and will be taken care of by its parent, so ignore it at renderLevel 1
+      return '';
+    }
+  }
+
   return retString;
 }
 
+// TO Add click-handlers etc.
+function postDOMRendering(optionsInfo) {
+  for (servicesKey in optionsInfo['services']) {
+    if (optionsInfo['services'][servicesKey]["isEnabled"] == true) {
+      for (property in optionsInfo['services'][servicesKey]["properties"]) {
+
+	      var option = optionsInfo['services'][servicesKey]["properties"][property];
+
+        var displayAttributes = null;
+        if (option['displayAttributes']) {
+          displayAttributes = option['displayAttributes'];
+          if(displayAttributes.hasOwnProperty("isMetaProperty") && displayAttributes["isMetaProperty"] == "true") {
+
+            // This is a meta-property
+            if (option.value == "checked") {
+              setRenderingForNestedProps(servicesKey, property, true);
+            } else {
+              setRenderingForNestedProps(servicesKey, property, false);
+            }
+
+            // Add clickhandlers
+            var metaNode = globalYui.one('#formElement-' + servicesKey + '-' + property);
+            metaNode.delegate('click', function (e) {
+              var splits = e.target.get('id').split("-");
+              var serviceOfThisProp = splits[1];
+              var propertyName = splits[2];
+              setRenderingForNestedProps(serviceOfThisProp, propertyName, e.target.get('checked'));
+          }, 'input[type=checkbox]');
+          }
+        }
+      }
+    }
+  }
+}
+
 function constructDOM(optionsInfo) {
   /* Reset globalPasswordsArray at the beginning of each render cycle to
    * avoid using stale data from the last run - this isn't a problem on the
@@ -56,21 +164,11 @@ function constructDOM(optionsInfo) {
     if (optionsInfo['services'][servicesKey]["isEnabled"] == true) {
       var serviceNeedsRender = false;
       var propertiesRendering = "";
+      globalOptionsInfo = optionsInfo;
       for (property in optionsInfo['services'][servicesKey]["properties"]) {
         // service has configs, so needs render
-        var type = convertDisplayType(optionsInfo['services'][servicesKey]['properties'][property]['type']);
-//      globalYui.log("TYPE: " + type + "Property: " + property);
-        if (type == "NODISPLAY") {
-            continue;
-        }
         serviceNeedsRender = true;
-        var unit = optionsInfo['services'][servicesKey]['properties'][property]['unit'];
-        var displayAttributes = null;
-        if (optionsInfo['services'][servicesKey]['properties'][property]['displayAttributes']) {
-           displayAttributes = optionsInfo['services'][servicesKey]['properties'][property]['displayAttributes'];
-        }
-
-        propertiesRendering += generateDivForService(optionsInfo['services'][servicesKey]["properties"][property], type, servicesKey, property, unit, displayAttributes);
+        propertiesRendering += generateDivForService(optionsInfo, servicesKey, property, 1);
       }
       if (serviceNeedsRender) {
         optionsSummary += "<fieldset> <legend>" + servicesKey + "</legend>";

Modified: incubator/ambari/branches/ambari-186/hmc/js/manageServices.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/js/manageServices.js?rev=1347181&r1=1347180&r2=1347181&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/js/manageServices.js (original)
+++ incubator/ambari/branches/ambari-186/hmc/js/manageServices.js Wed Jun  6 22:30:22 2012
@@ -291,6 +291,7 @@ function setupReconfigureScreens(service
     confirmationDataPanelBodyContent = '<div id="confirmationDataPanelBodyContent">' + confirmationDataPanelBodyContent + '</div>';
 
     confirmationDataPanel.set( 'bodyContent', confirmationDataPanelBodyContent );
+    postDOMRendering(serviceConfigurationData);
   });
 }