You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sr...@apache.org on 2013/04/10 00:54:17 UTC

svn commit: r1466280 - in /incubator/ambari/trunk: CHANGES.txt ambari-web/app/data/custom_configs.js ambari-web/app/utils/config.js ambari-web/app/views/common/configs/services_config.js

Author: srimanth
Date: Tue Apr  9 22:54:17 2013
New Revision: 1466280

URL: http://svn.apache.org/r1466280
Log:
AMBARI-1855. Capacity Scheduler: when adding a new queue, populate fields. (srimanth)

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/ambari-web/app/data/custom_configs.js
    incubator/ambari/trunk/ambari-web/app/utils/config.js
    incubator/ambari/trunk/ambari-web/app/views/common/configs/services_config.js

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1466280&r1=1466279&r2=1466280&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Tue Apr  9 22:54:17 2013
@@ -11,6 +11,9 @@ Trunk (unreleased changes):
  INCOMPATIBLE CHANGES 
 
  NEW FEATURES
+
+ AMBARI-1855. Capacity Scheduler: when adding a new queue, populate 
+ fields. (srimanth)
  
  AMBARI-1850. Update unit tests. (srimanth)
 

Modified: incubator/ambari/trunk/ambari-web/app/data/custom_configs.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/data/custom_configs.js?rev=1466280&r1=1466279&r2=1466280&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/data/custom_configs.js (original)
+++ incubator/ambari/trunk/ambari-web/app/data/custom_configs.js Tue Apr  9 22:54:17 2013
@@ -101,7 +101,7 @@ module.exports =
       "id": "site property",
       "name": "mapred.capacity-scheduler.queue.<queue-name>.supports-priority",
       "displayName": "Supports Priority",
-      "value": false,
+      "value": 'false',
       "defaultValue": false,
       "displayType": "checkbox",
       "description": "If true, priorities of jobs will be taken into account in scheduling decisions.",

Modified: incubator/ambari/trunk/ambari-web/app/utils/config.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/utils/config.js?rev=1466280&r1=1466279&r2=1466280&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/utils/config.js (original)
+++ incubator/ambari/trunk/ambari-web/app/utils/config.js Tue Apr  9 22:54:17 2013
@@ -275,44 +275,48 @@ App.config = Em.Object.create({
     } else {
       queueProperties = preDefinedCustomConfigs.filterProperty('isQueue');
       queueProperties.forEach(function (customConfig) {
-        this.setDefaultQueue(customConfig);
+        this.setDefaultQueue(customConfig, 'default');
         configs.push(customConfig);
       }, this);
     }
   },
   /**
-   * set values to properties of default queue
+   * set values to properties of queue
    * @param customConfig
+   * @param queueName
    */
-  setDefaultQueue: function (customConfig) {
-    customConfig.name = customConfig.name.replace(/<queue-name>/, 'default');
-    //values for default queue
+  setDefaultQueue: function (customConfig, queueName) {
+    customConfig.name = customConfig.name.replace(/<queue-name>/, queueName);
+    //default values of queue
     switch (customConfig.name) {
-      case 'mapred.capacity-scheduler.queue.default.capacity':
+      case 'mapred.capacity-scheduler.queue.' + queueName + '.capacity':
         customConfig.value = '100';
         break;
-      case 'mapred.capacity-scheduler.queue.default.maximum-capacity':
+      case 'mapred.capacity-scheduler.queue.' + queueName + '.maximum-capacity':
         customConfig.value = '100';
         break;
-      case 'mapred.capacity-scheduler.queue.default.minimum-user-limit-percent':
+      case 'mapred.capacity-scheduler.queue.' + queueName + '.minimum-user-limit-percent':
         customConfig.value = '100';
         break;
-      case 'mapred.capacity-scheduler.queue.default.user-limit-factor':
+      case 'mapred.capacity-scheduler.queue.' + queueName + '.user-limit-factor':
         customConfig.value = '1';
         break;
-      case 'mapred.capacity-scheduler.queue.default.maximum-initialized-active-tasks':
+      case 'mapred.capacity-scheduler.queue.' + queueName + '.maximum-initialized-active-tasks':
         customConfig.value = '200000';
         break;
-      case 'mapred.capacity-scheduler.queue.default.maximum-initialized-active-tasks-per-user':
+      case 'mapred.capacity-scheduler.queue.' + queueName + '.maximum-initialized-active-tasks-per-user':
         customConfig.value = '100000';
         break;
-      case 'mapred.capacity-scheduler.queue.default.init-accept-jobs-factor':
+      case 'mapred.capacity-scheduler.queue.' + queueName + '.init-accept-jobs-factor':
         customConfig.value = '10';
         break;
-      case 'mapred.queue.default.acl-submit-job':
+      case 'mapred.capacity-scheduler.queue.' + queueName + '.supports-priority':
+        customConfig.value = 'false';
+        break;
+      case 'mapred.queue.' + queueName + '.acl-submit-job':
         customConfig.value = '* *';
         break;
-      case 'mapred.queue.default.acl-administer-jobs':
+      case 'mapred.queue.' + queueName + '.acl-administer-jobs':
         customConfig.value = '* *';
         break;
     }

Modified: incubator/ambari/trunk/ambari-web/app/views/common/configs/services_config.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/common/configs/services_config.js?rev=1466280&r1=1466279&r2=1466280&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/common/configs/services_config.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/common/configs/services_config.js Tue Apr  9 22:54:17 2013
@@ -529,27 +529,35 @@ App.ServiceConfigCapacityScheduler = App
     if(isCollapsed){
       this.$('.accordion-body').hide();
     }
-    this.createEmptyQueue(this.get('queues')[0]);
+    this.createEmptyQueue(this.get('customConfigs').filterProperty('isQueue'));
   },
+  //list of fields which will be populated by default in a new queue
+  fieldsToPopulate: [
+    "mapred.capacity-scheduler.queue.<queue-name>.minimum-user-limit-percent",
+    "mapred.capacity-scheduler.queue.<queue-name>.user-limit-factor",
+    "mapred.capacity-scheduler.queue.<queue-name>.supports-priority",
+    "mapred.capacity-scheduler.queue.<queue-name>.maximum-initialized-active-tasks",
+    "mapred.capacity-scheduler.queue.<queue-name>.maximum-initialized-active-tasks-per-user",
+    "mapred.capacity-scheduler.queue.<queue-name>.init-accept-jobs-factor"
+  ],
   /**
    * create empty queue
    * take some queue then copy it and set all config values to null
-   * @param queue
+   * @param customConfigs
    */
-  createEmptyQueue: function(queue){
+  createEmptyQueue: function(customConfigs){
     var emptyQueue = {
       name: '<queue-name>',
       configs: []
     };
-    queue.configs.forEach(function(config){
-      var newConfig = App.ServiceConfigProperty.create(config);
-      if(newConfig.get('name') == 'mapred.capacity-scheduler.queue.' + queue.name + '.supports-priority'){
-        newConfig.set('value', false);
-      } else {
-        newConfig.set('value', '');
+    var fieldsToPopulate = this.get('fieldsToPopulate');
+    customConfigs.forEach(function(config){
+      var newConfig = $.extend({}, config);
+      if(fieldsToPopulate.contains(config.name)){
+        App.config.setDefaultQueue(newConfig, emptyQueue.name);
       }
-      //comparison executes including 'queue.<queue-name>' to avoid false matches
-      newConfig.set('name', newConfig.get('name').replace('queue.' + queue.name, 'queue.<queue-name>'));
+      newConfig = App.ServiceConfigProperty.create(newConfig);
+      newConfig.validate();
       emptyQueue.configs.push(newConfig);
     });
     this.set('emptyQueue', emptyQueue);
@@ -615,7 +623,7 @@ App.ServiceConfigCapacityScheduler = App
       var serviceConfigProperty = $.extend({}, _config);
       serviceConfigProperty.name = serviceConfigProperty.name.replace(/<queue-name>/, queueName);
       if(!queue.someProperty('name', serviceConfigProperty.name)){
-        App.config.setDefaultQueue(serviceConfigProperty);
+        App.config.setDefaultQueue(serviceConfigProperty, queueName);
         serviceConfigProperty = App.ServiceConfigProperty.create(serviceConfigProperty);
         serviceConfigProperty.validate();
         queue.push(serviceConfigProperty);