You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ak...@apache.org on 2014/04/18 18:28:17 UTC
git commit: AMBARI-5513. Flume service model should have mapper of
server data. (akovalenko)
Repository: ambari
Updated Branches:
refs/heads/trunk 0a21401f6 -> 04690bf92
AMBARI-5513. Flume service model should have mapper of server data. (akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/04690bf9
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/04690bf9
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/04690bf9
Branch: refs/heads/trunk
Commit: 04690bf92fe383ea2a071ef45137129c5641b705
Parents: 0a21401
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Fri Apr 18 19:25:25 2014 +0300
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Fri Apr 18 19:25:25 2014 +0300
----------------------------------------------------------------------
.../app/controllers/global/update_controller.js | 9 +-
.../app/mappers/service_metrics_mapper.js | 82 ++------
ambari-web/app/messages.js | 2 +-
ambari-web/app/models/service/flume.js | 201 +------------------
.../app/views/main/service/services/flume.js | 1 -
5 files changed, 30 insertions(+), 265 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/04690bf9/ambari-web/app/controllers/global/update_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/update_controller.js b/ambari-web/app/controllers/global/update_controller.js
index 66f6dea..f992af8 100644
--- a/ambari-web/app/controllers/global/update_controller.js
+++ b/ambari-web/app/controllers/global/update_controller.js
@@ -119,8 +119,10 @@ App.UpdateController = Em.Controller.extend({
var conditionalFields = this.getConditionalFields();
var conditionalFieldsString = conditionalFields.length > 0 ? ',' + conditionalFields.join(',') : '';
var testUrl = App.get('isHadoop2Stack') ? '/data/dashboard/HDP2/master_components.json' : '/data/dashboard/services.json';
-
- var realUrl = '/components/?ServiceComponentInfo/category=MASTER&fields=' +
+ var isFlumeInstalled = App.cache['services'].mapProperty('ServiceInfo.service_name').contains('FLUME');
+ var flumeHandlerParam = isFlumeInstalled ? 'ServiceComponentInfo/component_name=FLUME_HANDLER|' : '';
+ realUrl = '/components/?' + flumeHandlerParam +
+ 'ServiceComponentInfo/category=MASTER&fields=' +
'ServiceComponentInfo/Version,' +
'ServiceComponentInfo/StartTime,' +
'ServiceComponentInfo/HeapMemoryUsed,' +
@@ -164,7 +166,8 @@ App.UpdateController = Em.Controller.extend({
getConditionalFields: function () {
var conditionalFields = [];
var serviceSpecificParams = {
- 'FLUME': "host_components/metrics/flume/flume",
+ 'FLUME': "host_components/metrics/flume/flume," +
+ "host_components/processes/HostComponentProcess",
'YARN': "host_components/metrics/yarn/Queue," +
"ServiceComponentInfo/rm_metrics/cluster/activeNMcount," +
"ServiceComponentInfo/rm_metrics/cluster/unhealthyNMcount," +
http://git-wip-us.apache.org/repos/asf/ambari/blob/04690bf9/ambari-web/app/mappers/service_metrics_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/service_metrics_mapper.js b/ambari-web/app/mappers/service_metrics_mapper.js
index 789c0bf..832da08 100644
--- a/ambari-web/app/mappers/service_metrics_mapper.js
+++ b/ambari-web/app/mappers/service_metrics_mapper.js
@@ -135,6 +135,12 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
total_executors: 'restApiComponent.metrics.api.cluster.summary.["executors.total"]',
nimbus_uptime: 'restApiComponent.metrics.api.cluster.summary.["nimbus.uptime"]'
},
+ flumeAgentConfig: {
+ id: 'HostComponentProcess.name',
+ name: 'HostComponentProcess.name',
+ status: 'HostComponentProcess.status',
+ host_id: 'HostComponentProcess.host_name'
+ },
model3: App.HostComponent,
config3: {
@@ -217,13 +223,9 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
finalJson = this.flumeMapper(item);
finalJson.rand = Math.random();
result.push(finalJson);
- // TODO Below block to be uncommented when server data available
- /*if (finalJson.nodeObjs) {
- finalJson.nodeObjs.forEach(function (no) {
- App.store.load(App.FlumeNode, no);
- });
- }
- App.store.load(App.FlumeService, finalJson);*/
+ App.store.load(App.FlumeService, finalJson);
+ var agentsJson = this.flumeAgentMapper(item);
+ App.store.loadMany(App.FlumeAgent, agentsJson);
} else if (item && item.ServiceInfo && item.ServiceInfo.service_name == "YARN") {
finalJson = this.yarnMapper(item);
finalJson.rand = Math.random();
@@ -566,66 +568,24 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
/**
* Flume is different from other services, in that the important
- * data is in customizeable channels. Hence we directly transfer
+ * data is in customizable channels. Hence we directly transfer
* data into the JSON object.
*/
flumeMapper: function (item) {
- var finalConfig = jQuery.extend({}, this.config);
- var finalJson = this.parseIt(item, finalConfig);
- item.components.forEach(function (component) {
- if (component.ServiceComponentInfo && component.ServiceComponentInfo.component_name == "FLUME_HANDLER") {
- if (!finalJson.nodes) {
- finalJson.nodes = [];
- }
- if (!finalJson.nodeObjs) {
- finalJson.nodeObjs = [];
- }
- if (component.host_components) {
- component.host_components.forEach(function (hc) {
- var fnode = {};
- fnode.id = hc.HostRoles.host_name;
- fnode.host_id = hc.HostRoles.host_name;
- fnode.channels = "";
- fnode.sources = "";
- fnode.sinks = "";
- if (hc.metrics != null && hc.metrics.flume && hc.metrics.flume.flume && hc.metrics.flume.flume) {
- if (hc.metrics.flume.flume.CHANNEL) {
- for ( var c in hc.metrics.flume.flume.CHANNEL) {
- if (fnode.channels.length < 1) {
- fnode.channels += c;
- } else {
- fnode.channels += ("," + c);
- }
- }
- }
- if (hc.metrics.flume.flume.SINK) {
- for ( var c in hc.metrics.flume.flume.SINK) {
- if (fnode.sinks.length < 1) {
- fnode.sinks += c;
- } else {
- fnode.sinks += ("," + c);
- }
- }
- }
- if (hc.metrics.flume.flume.SOURCE) {
- for ( var c in hc.metrics.flume.flume.SOURCE) {
- if (fnode.sources.length < 1) {
- fnode.sources += c;
- } else {
- fnode.sources += ("," + c);
- }
- }
- }
- }
- finalJson.nodeObjs.push(fnode);
- finalJson.nodes.push(hc.HostRoles.host_name);
- });
- }
- }
- });
+ var finalJson = this.parseIt(item, this.config);
+ finalJson.agents = item.components[0].host_components[0].processes.mapProperty('HostComponentProcess.name');
return finalJson;
},
+ flumeAgentMapper: function (item) {
+ var dataToParse = item.components[0].host_components[0].processes;
+ var result = [];
+ dataToParse.forEach(function(dataItem){
+ result.push(this.parseIt(dataItem, this.flumeAgentConfig));
+ }, this);
+ return result;
+ },
+
/**
* Storm mapper
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/04690bf9/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 16ea945..4e32211 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1779,7 +1779,7 @@ Em.I18n.translations = {
'dashboard.services.mapreduce.jobTrackerUptime':'Job Trackers Uptime',
'dashboard.services.mapreduce.chart.label':'Jobs Running',
- 'dashboard.services.flume.summary.single':'{0} Flume Agent on ',
+ 'dashboard.services.flume.summary.single':'1 Flume Agent on ',
'dashboard.services.flume.summary.multiple':'{0} Flume Agents on ',
'dashboard.services.flume.summary.hosts.single':'1 host',
'dashboard.services.flume.summary.hosts.multiple':'{0} hosts',
http://git-wip-us.apache.org/repos/asf/ambari/blob/04690bf9/ambari-web/app/models/service/flume.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/service/flume.js b/ambari-web/app/models/service/flume.js
index dc0a6ad..68a83e2 100644
--- a/ambari-web/app/models/service/flume.js
+++ b/ambari-web/app/models/service/flume.js
@@ -94,202 +94,5 @@ App.FlumeAgent = DS.Model.extend({
}.property('status')
});
-App.FlumeAgent.FIXTURES = [ {
- id: 1,
- name: 'a1_dev01',
- status: 'INSTALLED',
- host: 'dev01.hortonworks.com',
- channels: 'c1,c2',
- sources: 'so1,so2,so3,so4',
- sinks: 'si1,si2'
-}, {
- id: 2,
- name: 'a2_dev01',
- status: 'STARTED',
- host: 'dev01.hortonworks.com',
- channels: 'c2',
- sources: 'so1,so2,so3,so4',
- sinks: 'si1,si2,si3,si4'
-}, {
- id: 3,
- name: 'a3_dev01',
- status: 'UNKNOWN',
- host: 'dev01.hortonworks.com',
- channels: 'c1, c4',
- sources: 'so1',
- sinks: 'si1,si2'
-}, {
- id: 4,
- name: 'a4_dev01',
- status: 'UNKNOWN',
- host: 'dev01.hortonworks.com',
- channels: 'c1,c2',
- sources: 'so1,so2,so3,so4',
- sinks: 'si1,si2'
-}, {
- id: 5,
- name: 'a5_dev01',
- status: 'STARTED',
- host: 'dev01.hortonworks.com',
- channels: 'c2',
- sources: 'so1,so2,so3,so4',
- sinks: 'si1,si2,si3,si4'
-}, {
- id: 6,
- name: 'a6_dev01',
- status: 'STARTED',
- host: 'dev01.hortonworks.com',
- channels: 'c1, c4',
- sources: 'so1',
- sinks: 'si1,si2'
-}, {
- id: 7,
- name: 'a7_dev01',
- status: 'INSTALLED',
- host: 'dev01.hortonworks.com',
- channels: 'c1,c2',
- sources: 'so1,so2,so3,so4',
- sinks: 'si1,si2'
-}, {
- id: 8,
- name: 'a8_dev01',
- status: 'STARTED',
- host: 'dev01.hortonworks.com',
- channels: 'c2',
- sources: 'so1,so2,so3,so4',
- sinks: 'si1,si2,si3,si4'
-}, {
- id: 9,
- name: 'a9_dev01',
- status: 'UNKNOWN',
- host: 'dev01.hortonworks.com',
- channels: 'c1, c4',
- sources: 'so1',
- sinks: 'si1,si2'
-}, {
- id: 10,
- name: 'a10_dev01',
- status: 'UNKNOWN',
- host: 'dev01.hortonworks.com',
- channels: 'c1,c2',
- sources: 'so1,so2,so3,so4',
- sinks: 'si1,si2'
-}, {
- id: 11,
- name: 'a11_dev01',
- status: 'STARTED',
- host: 'dev01.hortonworks.com',
- channels: 'c2',
- sources: 'so1,so2,so3,so4',
- sinks: 'si1,si2,si3,si4'
-}, {
- id: 12,
- name: 'a12_dev01',
- status: 'STARTED',
- host: 'dev01.hortonworks.com',
- channels: 'c1, c4',
- sources: 'so1',
- sinks: 'si1,si2'
-}, {
- id: 13,
- name: 'a13_dev01',
- status: 'INSTALLED',
- host: 'dev01.hortonworks.com',
- channels: 'c1,c2',
- sources: 'so1,so2,so3,so4',
- sinks: 'si1,si2'
-}, {
- id: 14,
- name: 'a14_dev01',
- status: 'STARTED',
- host: 'dev01.hortonworks.com',
- channels: 'c2',
- sources: 'so1,so2,so3,so4',
- sinks: 'si1,si2,si3,si4'
-}, {
- id: 15,
- name: 'a15_dev01',
- status: 'UNKNOWN',
- host: 'dev01.hortonworks.com',
- channels: 'c1, c4',
- sources: 'so1',
- sinks: 'si1,si2'
-}, {
- id: 16,
- name: 'a16_dev01',
- status: 'UNKNOWN',
- host: 'dev01.hortonworks.com',
- channels: 'c1,c2',
- sources: 'so1,so2,so3,so4',
- sinks: 'si1,si2'
-}, {
- id: 17,
- name: 'a17_dev01',
- status: 'STARTED',
- host: 'dev01.hortonworks.com',
- channels: 'c2',
- sources: 'so1,so2,so3,so4',
- sinks: 'si1,si2,si3,si4'
-}, {
- id: 18,
- name: 'a18_dev01',
- status: 'STARTED',
- host: 'dev01.hortonworks.com',
- channels: 'c1, c4',
- sources: 'so1',
- sinks: 'si1,si2'
-}, {
- id: 19,
- name: 'a19_dev01',
- status: 'INSTALLED',
- host: 'dev01.hortonworks.com',
- channels: 'c1,c2',
- sources: 'so1,so2,so3,so4',
- sinks: 'si1,si2'
-}, {
- id: 20,
- name: 'a20_dev01',
- status: 'STARTED',
- host: 'dev01.hortonworks.com',
- channels: 'c2',
- sources: 'so1,so2,so3,so4',
- sinks: 'si1,si2,si3,si4'
-}, {
- id: 21,
- name: 'a21_dev01',
- status: 'UNKNOWN',
- host: 'dev01.hortonworks.com',
- channels: 'c1, c4',
- sources: 'so1',
- sinks: 'si1,si2'
-}, {
- id: 22,
- name: 'a22_dev01',
- status: 'UNKNOWN',
- host: 'dev01.hortonworks.com',
- channels: 'c1,c2',
- sources: 'so1,so2,so3,so4',
- sinks: 'si1,si2'
-}, {
- id: 23,
- name: 'a23_dev01',
- status: 'STARTED',
- host: 'dev01.hortonworks.com',
- channels: 'c2',
- sources: 'so1,so2,so3,so4',
- sinks: 'si1,si2,si3,si4'
-}, {
- id: 24,
- name: 'a24_dev01',
- status: 'STARTED',
- host: 'dev01.hortonworks.com',
- channels: 'c1, c4',
- sources: 'so1',
- sinks: 'si1,si2'
-} ];
-App.FlumeService.FIXTURES = [ {
- id: 0,
- version: '1.4.0',
- service_name: 'FLUME',
- agents: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 ]
-} ];
+App.FlumeAgent.FIXTURES = [];
+App.FlumeService.FIXTURES = [];
http://git-wip-us.apache.org/repos/asf/ambari/blob/04690bf9/ambari-web/app/views/main/service/services/flume.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/services/flume.js b/ambari-web/app/views/main/service/services/flume.js
index 4e24545..f700116 100644
--- a/ambari-web/app/views/main/service/services/flume.js
+++ b/ambari-web/app/views/main/service/services/flume.js
@@ -116,7 +116,6 @@ App.MainDashboardServiceFlumeView = App.TableView.extend({
this.set('controller.selectedFlumeAgent', agent);
this.toggleHighlight($(event.currentTarget));
this.setAgentMetrics(event.context);
- this.get('parentView').setMetric(agent);
},
/**
* Highlight current row and remove highlight from previously selected item.