incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yus...@apache.org
Subject svn commit: r1418931 - in /incubator/ambari/branches/AMBARI-666: ./ ambari-web/app/ ambari-web/app/controllers/global/ ambari-web/app/controllers/main/ ambari-web/app/mappers/ ambari-web/app/models/service/ ambari-web/app/templates/main/dashboard/servi...
Date Sun, 09 Dec 2012 13:11:14 GMT
Author: yusaku
Date: Sun Dec  9 13:11:13 2012
New Revision: 1418931

URL: http://svn.apache.org/viewvc?rev=1418931&view=rev
Log:
AMBARI-1008. Populate dashboard>MapReduce section with API data. (Srimanth Gunturi via
yusaku)

Added:
    incubator/ambari/branches/AMBARI-666/ambari-web/app/models/service/mapreduce.js
Modified:
    incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/global/cluster_controller.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/dashboard.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/services_mapper.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/messages.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/models.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/dashboard/service/mapreduce.hbs
    incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/dashboard/service/mapreduce.js

Modified: incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt?rev=1418931&r1=1418930&r2=1418931&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt (original)
+++ incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt Sun Dec  9 13:11:13 2012
@@ -12,6 +12,9 @@ AMBARI-666 branch (unreleased changes)
 
   NEW FEATURES
 
+  AMBARI-1008. Populate dashboard>MapReduce section with API data.
+  (Srimanth Gunturi via yusaku)
+
   AMBARI-1006. Populate dashboard>HDFS section with API data.
   (Srimanth Gunturi via yusaku)
 

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/global/cluster_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/global/cluster_controller.js?rev=1418931&r1=1418930&r2=1418931&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/global/cluster_controller.js
(original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/global/cluster_controller.js
Sun Dec  9 13:11:13 2012
@@ -229,30 +229,50 @@ App.ClusterController = Em.Controller.ex
           if(metricsJson!=null && serviceComponentJson!=null){
             var hdfsSvc1 = null;
             var hdfsSvc2 = null;
+            var mrSvc1 = null;
+            var mrSvc2 = null;
             metricsJson.items.forEach(function(svc){
               if(svc.ServiceInfo.service_name=="HDFS"){
                 hdfsSvc1 = svc;
               }
+              if(svc.ServiceInfo.service_name=="MAPREDUCE"){
+                mrSvc1 = svc;
+              }
             });
             serviceComponentJson.items.forEach(function(svc){
               if(svc.ServiceInfo.service_name=="HDFS"){
                 hdfsSvc2 = svc;
               }
+              if(svc.ServiceInfo.service_name=="MAPREDUCE"){
+                mrSvc2 = svc;
+              }
             });
-            var nameNode1 = null;
-            var nameNode2 = null;
+            var nnC1 = null;
+            var nnC2 = null;
+            var jtC1 = null;
+            var jtC2 = null;
             hdfsSvc1.components.forEach(function(c){
               if(c.ServiceComponentInfo.component_name=="NAMENODE"){
-                nameNode1 = c;
+                nnC1 = c;
               }
             });
             hdfsSvc2.components.forEach(function(c){
               if(c.ServiceComponentInfo.component_name=="NAMENODE"){
-                nameNode2 = c;
+                nnC2 = c;
               }
             });
-            nameNode1.ServiceComponentInfo = nameNode2.ServiceComponentInfo;
-
+            mrSvc1.components.forEach(function(c){
+              if(c.ServiceComponentInfo.component_name=="JOBTRACKER"){
+                jtC1 = c;
+              }
+            });
+            mrSvc2.components.forEach(function(c){
+              if(c.ServiceComponentInfo.component_name=="JOBTRACKER"){
+                jtC2 = c;
+              }
+            });
+            nnC1.ServiceComponentInfo = nnC2.ServiceComponentInfo;
+            jtC1.ServiceComponentInfo = jtC2.ServiceComponentInfo;
             App.servicesMapper.map(metricsJson);
             self.updateLoadStatus('services');
           }

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/dashboard.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/dashboard.js?rev=1418931&r1=1418930&r2=1418931&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/dashboard.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/dashboard.js Sun
Dec  9 13:11:13 2012
@@ -24,31 +24,6 @@ App.MainDashboardController = Em.Control
     return App.router.get('clusterController.alerts');
   }.property('App.router.clusterController.alerts'),
   data: {
-    MAPREDUCE: {
-      "jobtracker_addr": "jobtracker:50030",
-      "jobtracker_starttime": 1348935243,
-      "running_jobs": 1,
-      "waiting_jobs": 0,
-      "trackers_total": "1",
-      "trackers_live": 1,
-      "trackers_graylisted": 0,
-      "trackers_blacklisted": 0,
-      "chart": [4,8,7,2,1,4,3,3,3],
-      // additionals
-      "map_slots_occuped": 4,
-      "map_slots_reserved": 8,
-      "map_slots_total": 12,
-
-      "reduce_slots_occuped": 3,
-      "reduce_slots_reserved": 7,
-      "reduce_slots_total": 11,
-
-      "completed_jobs": 3,
-      "failed_jobs": 2,
-
-      "trackers_heap_used": 1348935243,
-      "trackers_heap_total": 6648935243
-    },
     hbase : {
       "hbasemaster_addr": "hbasemaster:60010",
       "total_regionservers": "1",

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/services_mapper.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/services_mapper.js?rev=1418931&r1=1418930&r2=1418931&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/services_mapper.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/services_mapper.js Sun Dec
 9 13:11:13 2012
@@ -51,6 +51,30 @@ App.servicesMapper = App.QuickDataMapper
     upgradeStatus: 'nameNodeComponent.ServiceComponentInfo.UpgradeFinalized',
     safeModeStatus: 'nameNodeComponent.ServiceComponentInfo.Safemode'
   },
+  
+  mapReduceConfig: {
+    version: 'jobTrackerComponent.ServiceComponentInfo.Version',
+    job_tracker_id: 'jobTrackerComponent.host_components[0].HostRoles.host_name',
+    task_trackers: 'task_trackers',
+    job_tracker_start_time: 'jobTrackerComponent.ServiceComponentInfo.StartTime',
+    job_tracker_heap_used: 'jobTrackerComponent.ServiceComponentInfo.HeapMemoryUsed',
+    job_tracker_heap_max: 'jobTrackerComponent.ServiceComponentInfo.HeapMemoryMax',
+    alive_trackers: 'alive_trackers',
+    black_list_trackers: 'black_list_trackers',
+    gray_list_trackers: 'gray_list_trackers',
+    map_slots: 'map_slots',
+    reduce_slots: 'reduce_slots'
+//    jobsSubmitted: DS.attr('number'),
+//    jobsCompleted: DS.attr('number'),
+//    mapSlotsOccupied: DS.attr('number'),
+//    mapSlotsReserved: DS.attr('number'),
+//    reduceSlotsOccupied: DS.attr('number'),
+//    reduceSlotsReserved: DS.attr('number'),
+//    mapsRunning: DS.attr('number'),
+//    mapsWaiting: DS.attr('number'),
+//    reducesRunning: DS.attr('number'),
+//    reducesWaiting: DS.attr('number')
+  },
 
   model2: App.Component,
   config2: {
@@ -79,9 +103,9 @@ App.servicesMapper = App.QuickDataMapper
               item.nameNodeComponent = component;
               finalConfig = jQuery.extend(finalConfig, hdfsConfig);
               // Get the live, dead & decommision nodes from string json
-              liveNodesJson = jQuery.parseJSON(component.ServiceComponentInfo.LiveNodes);
-              deadNodesJson = jQuery.parseJSON(component.ServiceComponentInfo.DeadNodes);
-              decommisionNodesJson = jQuery.parseJSON(component.ServiceComponentInfo.DecomNodes);
+              var liveNodesJson = jQuery.parseJSON(component.ServiceComponentInfo.LiveNodes);
+              var deadNodesJson = jQuery.parseJSON(component.ServiceComponentInfo.DeadNodes);
+              var decommisionNodesJson = jQuery.parseJSON(component.ServiceComponentInfo.DecomNodes);
               item.live_data_nodes = [];
               item.dead_data_nodes = [];
               item.decommision_data_nodes = [];
@@ -109,6 +133,51 @@ App.servicesMapper = App.QuickDataMapper
           var finalJson = this.parseIt(item, finalConfig);
           result.push(finalJson);
           App.store.load(App.HDFSService, finalJson);
+        } else if (item && item.ServiceInfo && item.ServiceInfo.service_name
== "MAPREDUCE") {
+            // Change the JSON so that it is easy to map
+            var mapReduceConfig = this.mapReduceConfig;
+            item.components.forEach(function (component) {
+              if (component.ServiceComponentInfo && component.ServiceComponentInfo.component_name
== "JOBTRACKER") {
+                item.jobTrackerComponent = component;
+                finalConfig = jQuery.extend(finalConfig, mapReduceConfig);
+                // Get the live, gray & black nodes from string json
+                item.map_slots = 0;
+                item.reduce_slots = 0;
+                var liveNodesJson = jQuery.parseJSON(component.ServiceComponentInfo.AliveNodes);
+                var grayNodesJson = jQuery.parseJSON(component.ServiceComponentInfo.GrayListedNodes);
+                var blackNodesJson = jQuery.parseJSON(component.ServiceComponentInfo.BlackListedNodes);
+                item.alive_trackers = [];
+                item.gray_list_trackers = [];
+                item.black_list_trackers = [];
+                liveNodesJson.forEach(function(nj){
+                  item.alive_trackers.push(nj.hostname);
+                  if(nj.slots && nj.slots.map_slots)
+                    item.map_slots += nj.slots.map_slots;
+                  if(nj.slots && nj.slots.map_slots_used)
+                    item.map_slots_used += nj.slots.map_slots_used;
+                  if(nj.slots && nj.slots.reduce_slots)
+                    item.reduce_slots += nj.slots.reduce_slots;
+                  if(nj.slots && nj.slots.reduce_slots_used)
+                    item.reduce_slots_used += nj.slots.reduce_slots_used;
+                });
+                grayNodesJson.forEach(function(nj){
+                  item.gray_list_trackers.push(nj.hostname);
+                });
+                blackNodesJson.forEach(function(nj){
+                  item.black_list_trackers.push(nj.hostname);
+                });
+              }
+              if (component.ServiceComponentInfo && component.ServiceComponentInfo.component_name
== "TASKTRACKER") {
+                if(!item.task_trackers){
+                  item.task_trackers = [];
+                }
+                item.task_trackers.push(component.host_components[0].HostRoles.host_name);
+              }
+            });
+            // Map
+            finalJson = this.parseIt(item, finalConfig);
+            result.push(finalJson);
+            App.store.load(App.MapReduceService, finalJson);
         } else {
           result.push(this.parseIt(item, this.config));
         }

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/messages.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/messages.js?rev=1418931&r1=1418930&r2=1418931&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/messages.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/messages.js Sun Dec  9 13:11:13 2012
@@ -204,7 +204,8 @@ Em.I18n.translations = {
   'services.service.summary.blocksTotal': 'Blocks (total)',
   'services.service.summary.blockErrors': 'Block Errors',
   'services.service.summary.totalFiles': 'Total Files + Dirs',
-  'services.service.summary.jobTracker': 'JobTracker Web UI',
+  'services.service.summary.jobTracker': 'JobTracker',
+  'services.service.summary.jobTrackerWebUI': 'JobTracker Web UI',
   'services.service.summary.jobTrackerUptime': 'JobTracker Uptime',
   'services.service.summary.trackersLiveTotal': 'Trackers',
   'services.service.summary.trackersBlacklistGraylist': 'Trackers',
@@ -281,7 +282,7 @@ Em.I18n.translations = {
   'dashboard.services.hdfs.capacityUsed': '{0} / {1} ({2}% used)',
   'dashboard.services.hdfs.totalFilesAndDirs': 'Total Files + Directories',
   'dashboard.services.hdfs.datanodes': 'DataNodes',
-  'dashboard.services.hdfs.datanodecounts': 'DataNode Status',
+  'dashboard.services.hdfs.datanodecounts': 'DataNodes Status',
   'dashboard.services.hdfs.version': 'Version',
   'dashboard.services.hdfs.nameNodeWebUI': 'NameNode Web UI',
   'dashboard.services.hdfs.nodes.live': 'live',
@@ -292,15 +293,24 @@ Em.I18n.translations = {
   'dashboard.services.hdfs.nodes.heapUsed': '{0} / {1} ({2}% used)',
   'dashboard.services.hdfs.chart.label': 'Capacity (Free/Used)',
 
-  'dashboard.services.mapreduce.summary': '{0} of {1} trackers live, {2} jobs running',
+  'dashboard.services.mapreduce.summary': '{0} of {1} trackers live, {2} jobs running, {3}
jobs waiting',
+  'dashboard.services.mapreduce.taskTrackers': 'TaskTrackers',
+  'dashboard.services.mapreduce.taskTrackerCounts': 'TaskTrackers Status',
   'dashboard.services.mapreduce.trackers': 'Trackers',
+  'dashboard.services.mapreduce.nodes.blacklist': 'blacklist',
+  'dashboard.services.mapreduce.nodes.graylist': 'graylist',
+  'dashboard.services.mapreduce.slotCapacity': 'Total Slots Capacity',
   'dashboard.services.mapreduce.trackersSummary': '{0} live / {1} total',
-  'dashboard.services.mapreduce.jobs': 'Jobs',
-  'dashboard.services.mapreduce.jobsSummary': '{0} running / {1} completed / {2} failed',
+  'dashboard.services.mapreduce.jobs': 'Total Jobs',
+  'dashboard.services.mapreduce.jobsSummary': '{0} submitted / {1} completed',
   'dashboard.services.mapreduce.mapSlots': 'Map Slots',
-  'dashboard.services.mapreduce.mapSlotsSummary': '{0} occuped / {1} reserved / {2} total',
+  'dashboard.services.mapreduce.mapSlotsSummary': '{0} occuped / {1} reserved',
   'dashboard.services.mapreduce.reduceSlots': 'Reduce Slots',
-  'dashboard.services.mapreduce.reduceSlotsSummary': '{0} occuped / {1} reserved / {2} total',
+  'dashboard.services.mapreduce.tasks.maps': 'Tasks: Maps',
+  'dashboard.services.mapreduce.tasks.reduces': 'Tasks: Reduces',
+  'dashboard.services.mapreduce.reduceSlotsSummary': '{0} occuped / {1} reserved',
+  'dashboard.services.mapreduce.tasksSummary': '{0} running / {1} waiting',
+  'dashboard.services.mapreduce.slotCapacitySummary': '{0} maps / {1} reduces / {2} avg per
node',
   'dashboard.services.mapreduce.jobTrackerHeap': 'JobTracker Heap',
   'dashboard.services.mapreduce.jobTrackerHeapSummary': '{0} of {1} ({2}% used)',
   'dashboard.services.mapreduce.jobTrackerUptime': 'Job Trackers Uptime',

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/models.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/models.js?rev=1418931&r1=1418930&r2=1418931&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/models.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/models.js Sun Dec  9 13:11:13 2012
@@ -30,6 +30,7 @@ require('models/service_config');
 require('models/service_audit');
 require('models/service_metrics');
 require('models/service/hdfs');
+require('models/service/mapreduce');
 require('models/alert');
 require('models/user');
 require('models/pagination');

Added: incubator/ambari/branches/AMBARI-666/ambari-web/app/models/service/mapreduce.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/models/service/mapreduce.js?rev=1418931&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/models/service/mapreduce.js (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/models/service/mapreduce.js Sun Dec
 9 13:11:13 2012
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+var App = require('app');
+
+App.MapReduceService = App.Service.extend({
+  version: DS.attr('string'),
+  jobTracker: DS.belongsTo('App.Host'),
+  taskTrackers: DS.hasMany('App.Host'),
+  jobTrackerStartTime: DS.attr('number'),
+  jobTrackerHeapUsed: DS.attr('number'),
+  jobTrackerHeapMax: DS.attr('number'),
+  aliveTrackers: DS.hasMany('App.Host'),
+  blackListTrackers: DS.hasMany('App.Host'),
+  grayListTrackers: DS.hasMany('App.Host'),
+  mapSlots: DS.attr('number'),
+  reduceSlots: DS.attr('number'),
+  jobsSubmitted: DS.attr('number'),
+  jobsCompleted: DS.attr('number'),
+  mapSlotsOccupied: DS.attr('number'),
+  mapSlotsReserved: DS.attr('number'),
+  reduceSlotsOccupied: DS.attr('number'),
+  reduceSlotsReserved: DS.attr('number'),
+  mapsRunning: DS.attr('number'),
+  mapsWaiting: DS.attr('number'),
+  reducesRunning: DS.attr('number'),
+  reducesWaiting: DS.attr('number')
+});
+
+App.MapReduceService.FIXTURES = [];

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/dashboard/service/mapreduce.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/dashboard/service/mapreduce.hbs?rev=1418931&r1=1418930&r2=1418931&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/dashboard/service/mapreduce.hbs
(original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/dashboard/service/mapreduce.hbs
Sun Dec  9 13:11:13 2012
@@ -31,60 +31,85 @@
 <table class="table no-borders">
   <tbody>
 
+  <!-- JobTracker -->
+  <tr>
+    <td>{{t services.service.summary.jobTracker}}</td>
+    <td><a href="#" {{action showDetails view.service.jobTracker}}>{{view.service.jobTracker.hostName}}</a></td>
+  </tr>
+  <!-- TaskTrackers -->
+  <tr>
+    <td>{{t dashboard.services.mapreduce.taskTrackers}}</td>
+    <td><a href="#" {{action filterHosts view.taskTrackerComponent}}>{{view.service.taskTrackers.length}}
{{t dashboard.services.mapreduce.taskTrackers}}</a></td>
+  </tr>
+  <!-- Version -->
+  <tr>
+    <td>{{t dashboard.services.hdfs.version}}</td>
+    <td>{{view.service.version}}</td>
+  </tr>
+  <!-- JobTracker Web UI -->
+  <tr>
+    <td>{{t services.service.summary.jobTrackerWebUI}}</td>
+    <td><a {{bindAttr href="view.jobTrackerWebUrl"}}>{{view.service.jobTracker.hostName}}:50030</a>
+    </td>
+  </tr>
+  <!-- Job Tracker Uptime -->
+  <tr>
+    <td>{{t dashboard.services.mapreduce.jobTrackerUptime}}</td>
+    <td>{{view.jobTrackerUptime}}</td>
+  </tr>
   <!-- Trackers -->
   <tr>
     <td>{{t dashboard.services.mapreduce.trackers}}</td>
     <td>{{view.trackersSummary}}</td>
   </tr>
-
+  <!-- TaskTracker Counts -->
+  <tr>
+    <td>{{t dashboard.services.mapreduce.taskTrackerCounts}}</td>
+    <td>
+      {{view.service.grayListTrackers.length}} {{t dashboard.services.mapreduce.nodes.blacklist}}
/
+      {{view.service.blackListTrackers.length}} {{t dashboard.services.mapreduce.nodes.graylist}}
+    </td>
+  </tr>
+  <!-- JobTracker Heap -->
+  <tr>
+    <td>{{t dashboard.services.mapreduce.jobTrackerHeap}}</td>
+    <td>{{view.trackersHeapSummary}}</td>
+  </tr>
+  <!-- Total slots capacity -->
+  <tr>
+    <td>{{t dashboard.services.mapreduce.slotCapacity}}</td>
+    <td>{{view.slotsCapacitySummary}}</td>
+  </tr>
   <!-- Jobs -->
   <tr>
     <td>{{t dashboard.services.mapreduce.jobs}}</td>
     <td>{{view.jobsSummary}}</td>
   </tr>
-
   <!-- Map Slots -->
   <tr>
     <td>{{t dashboard.services.mapreduce.mapSlots}}</td>
     <td>{{view.mapSlotsSummary}}</td>
   </tr>
-
   <!-- Reduce Slots -->
   <tr>
     <td>{{t dashboard.services.mapreduce.reduceSlots}}</td>
     <td>{{view.reduceSlotsSummary}}</td>
   </tr>
-
-  <!-- Job Tracker Uptime -->
+  <!-- Tasks:Maps -->
   <tr>
-    <td>{{t dashboard.services.mapreduce.jobTrackerUptime}}</td>
-    <td>{{view.jobTrackerUptime}}</td>
+    <td>{{t dashboard.services.mapreduce.tasks.maps}}</td>
+    <td>{{view.mapTasksSummary}}</td>
   </tr>
-
-  <!-- JobTracker Heap -->
-  <tr>
-    <td>{{t dashboard.services.mapreduce.jobTrackerHeap}}</td>
-    <td>{{view.trackersHeapSummary}}</td>
-  </tr>
-
-  <!-- Hosts -->
+  <!-- Tasks:Reduces -->
   <tr>
-    <td>{{t dashboard.services.hosts}}</td>
-    <td>
-      {{#each component in view.service.components}}
-      {{#if component.type}}
-      <a href="#" {{action selectHost component.host}}>{{component.displayName}}</a>,
-      {{else}}
-      <a href="#" {{action filterHosts component}}>{{component.displayName}}</a>
-      {{/if}}
-      {{/each}}
-    </td>
+    <td>{{t dashboard.services.mapreduce.tasks.reduces}}</td>
+    <td>{{view.reduceTasksSummary}}</td>
   </tr>
   </tbody>
 </table>
 <div class="chart">
-  {{view view.Chart}}
-  <div class="chartLabel">{{t dashboard.services.mapreduce.chart.label}}</div>
+  {{view App.ChartServiceMetricsMapReduce_JobsRunningWaiting}}
+  
   {{#if view.service.quickLinks.length}}
   {{#view App.QuickViewLinks contentBinding="view.service"}}
   <div class="btn-group">

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/dashboard/service/mapreduce.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/dashboard/service/mapreduce.js?rev=1418931&r1=1418930&r2=1418931&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/dashboard/service/mapreduce.js
(original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/dashboard/service/mapreduce.js
Sun Dec  9 13:11:13 2012
@@ -1,80 +1,101 @@
 /**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
  * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
  */
 
 var App = require('app');
 
 App.MainDashboardServiceMapreduceView = App.MainDashboardServiceView.extend({
-  templateName:require('templates/main/dashboard/service/mapreduce'),
-  serviceName:'MAPREDUCE',
+  templateName: require('templates/main/dashboard/service/mapreduce'),
+  serviceName: 'MAPREDUCE',
 
-  Chart:App.ChartLinearView.extend({
-    data:function () {
+  service: function () {
+    return App.MapReduceService.find().objectAt(0);
+  }.property('App.router.clusterController.dataLoadList.services'),
+
+  jobTrackerWebUrl: function () {
+    return "http://" + this.get('service').get('jobTracker').get('hostName') + ":50030";
+  }.property('service.nameNode'),
+
+  Chart: App.ChartLinearView.extend({
+    data: function () {
       return this.get('_parentView.data.chart');
     }.property('_parentView.data.chart')
   }),
 
-  jobTrackerUptime:function () {
-    var uptime = this.get('data.jobtracker_starttime') + 0;
-    var formatted = uptime.toDaysHoursMinutes();
+  jobTrackerUptime: function () {
+    var uptime = this.get('service').get('jobTrackerStartTime');
+    var formatted = (new Date().getTime() - uptime).toDaysHoursMinutes();
     return this.t('dashboard.services.uptime').format(formatted.d, formatted.h, formatted.m);
-  }.property("data"),
+  }.property("service.jobTrackerStartTime"),
 
-  summaryHeader:function () {
+  summaryHeader: function () {
+    var svc = this.get('service');
+    var liveCount = svc.get('aliveTrackers').get('length');
+    var allCount = svc.get('taskTrackers').get('length');
+    var runningCount = svc.get('mapsRunning') + svc.get('reducesRunning');
+    var waitingCount = svc.get('mapsWaiting') + svc.get('reducesWaiting');
     var template = this.t('dashboard.services.mapreduce.summary');
-    return template.format(this.get('data.trackers_live'), this.get('data.trackers_total'),
this.get('data.running_jobs'));
-  }.property('data'),
+    return template.format(liveCount, allCount, runningCount, waitingCount);
+  }.property('service'),
 
-  trackersSummary:function () {
+  trackersSummary: function () {
+    var svc = this.get('service');
+    var liveCount = svc.get('aliveTrackers').get('length');
+    var totalCount = svc.get('taskTrackers').get('length');
     var template = this.t('dashboard.services.mapreduce.trackersSummary');
-    return template.format(this.get('data.trackers_live'), this.get('data.trackers_total'));
-  }.property('data'),
+    return template.format(liveCount, totalCount);
+  }.property('service'),
 
-  trackersHeapSummary:function () {
-    var percent =
-      this.get('data.trackers_heap_total') > 0
-        ? 100 * this.get('data.trackers_heap_used') / this.get('data.trackers_heap_total')
-        : 0;
-
-    return this.t('dashboard.services.mapreduce.jobTrackerHeapSummary').format(
-      this.get('data.trackers_heap_used').bytesToSize(1, "parseFloat"),
-      this.get('data.trackers_heap_total').bytesToSize(1, "parseFloat"),
-      percent.toFixed(1)
-    );
-  }.property('data'),
+  trackersHeapSummary: function () {
+    var heapUsed = this.get('service').get('jobTrackerHeapUsed');
+    var heapMax = this.get('service').get('jobTrackerHeapMax');
+    var percent = heapMax > 0 ? 100 * heapUsed / heapMax : 0;
+    return this.t('dashboard.services.mapreduce.jobTrackerHeapSummary').format(heapUsed.bytesToSize(1,
"parseFloat"), heapMax.bytesToSize(1, "parseFloat"), percent.toFixed(1));
+  }.property('service'),
 
-  jobsSummary:function () {
+  jobsSummary: function () {
     var template = this.t('dashboard.services.mapreduce.jobsSummary');
-    return template.format(this.get('data.running_jobs'), this.get('data.completed_jobs'),
this.get('data.failed_jobs'));
-  }.property('data'),
+    return template.format(0, 0, 0);
+  }.property('service'),
 
-  mapSlotsSummary:function () {
-    return this.t('dashboard.services.mapreduce.mapSlotsSummary').format(
-      this.get('data.map_slots_occuped'),
-      this.get('data.map_slots_reserved'),
-      this.get('data.map_slots_total')
-    );
-  }.property('data'),
-
-  reduceSlotsSummary:function () {
-    return this.t('dashboard.services.mapreduce.reduceSlotsSummary').format(
-      this.get('data.reduce_slots_occuped'),
-      this.get('data.reduce_slots_reserved'),
-      this.get('data.reduce_slots_total')
-    );
-  }.property('data')
+  mapSlotsSummary: function () {
+    return this.t('dashboard.services.mapreduce.mapSlotsSummary').format(0,0);
+  }.property('service'),
+
+  reduceSlotsSummary: function () {
+    return this.t('dashboard.services.mapreduce.reduceSlotsSummary').format(0,0);
+  }.property('service'),
+
+  mapTasksSummary: function () {
+    return this.t('dashboard.services.mapreduce.tasksSummary').format(0,0);
+  }.property('service'),
+
+  reduceTasksSummary: function () {
+    return this.t('dashboard.services.mapreduce.tasksSummary').format(0,0);
+  }.property('service'),
+
+  slotsCapacitySummary: function () {
+    var mapSlots = this.get('service').get('mapSlots');
+    var reduceSlots = this.get('service').get('reduceSlots');
+    var liveNodeCount = this.get('service').get('aliveTrackers').get('length');
+    var avg = (mapSlots + reduceSlots)/liveNodeCount;
+    return this.t('dashboard.services.mapreduce.slotCapacitySummary').format(mapSlots, reduceSlots,
avg);
+  }.property('service'),
+
+  taskTrackerComponent: function () {
+    return App.Component.find().findProperty('componentName', 'TASKTRACKER');
+  }.property('components')
 });
\ No newline at end of file



Mime
View raw message