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 2014/05/31 01:41:41 UTC
git commit: Miscellaneous fixes for issues discovered during testing
(srimanth)
Repository: ambari
Updated Branches:
refs/heads/branch-1.6.0.slider b524dd031 -> 74f138a4b
Miscellaneous fixes for issues discovered during testing (srimanth)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/74f138a4
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/74f138a4
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/74f138a4
Branch: refs/heads/branch-1.6.0.slider
Commit: 74f138a4b556770358889a8972f7312ccb2b2db5
Parents: b524dd0
Author: Srimanth Gunturi <sg...@hortonworks.com>
Authored: Fri May 30 16:40:44 2014 -0700
Committer: Srimanth Gunturi <sg...@hortonworks.com>
Committed: Fri May 30 16:40:44 2014 -0700
----------------------------------------------------------------------
.../slider/SliderAppsViewControllerImpl.java | 20 ++++++++++++----
.../view/slider/rest/SliderAppsResource.java | 8 +++++--
.../ui/app/controllers/slider_app_controller.js | 13 +++++++++--
.../ui/app/mappers/slider_apps_mapper.js | 10 +-------
.../ui/app/views/slider_app/summary_view.js | 24 ++++++++++++++------
5 files changed, 50 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/74f138a4/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java
index 97919f6..2b0e140 100644
--- a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java
+++ b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java
@@ -947,7 +947,10 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController {
return sliderClient.applicationId;
}
});
- logger.debug("Slider app has been frozen - " + applicationId.toString());
+ if (applicationId != null) {
+ logger
+ .debug("Slider app has been frozen - " + applicationId.toString());
+ }
} finally {
Thread.currentThread().setContextClassLoader(currentClassLoader);
}
@@ -976,7 +979,10 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController {
return sliderClient.applicationId;
}
});
- logger.debug("Slider app has been thawed - " + applicationId.toString());
+ if (applicationId != null) {
+ logger
+ .debug("Slider app has been thawed - " + applicationId.toString());
+ }
} finally {
Thread.currentThread().setContextClassLoader(currentClassLoader);
}
@@ -1002,15 +1008,19 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController {
SliderClient sliderClient = getSliderClient();
ActionFlexArgs flexArgs = new ActionFlexArgs();
flexArgs.parameters.add(sliderApp.getName());
- for (Entry<String, Integer> e : componentsMap.entrySet()){
+ for (Entry<String, Integer> e : componentsMap.entrySet()) {
flexArgs.componentDelegate.componentTuples.add(e.getKey());
- flexArgs.componentDelegate.componentTuples.add(e.getValue().toString());
+ flexArgs.componentDelegate.componentTuples.add(e.getValue()
+ .toString());
}
sliderClient.actionFlex(sliderApp.getName(), flexArgs);
return sliderClient.applicationId;
}
});
- logger.debug("Slider app has been thawed - " + applicationId.toString());
+ if (applicationId != null) {
+ logger
+ .debug("Slider app has been flexed - " + applicationId.toString());
+ }
} finally {
Thread.currentThread().setContextClassLoader(currentClassLoader);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/74f138a4/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/rest/SliderAppsResource.java
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/rest/SliderAppsResource.java b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/rest/SliderAppsResource.java
index 6cee80e..055cb2f 100644
--- a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/rest/SliderAppsResource.java
+++ b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/rest/SliderAppsResource.java
@@ -91,10 +91,13 @@ public class SliderAppsResource {
JsonObject requestJson = requestContent.getAsJsonObject();
if (requestJson.has("state")) {
String newState = requestJson.get("state").getAsString();
- if ("FROZEN".equals(newState))
+ if ("FROZEN".equals(newState)) {
sliderAppsViewController.freezeApp(appId);
- else if ("RUNNING".equals(newState))
+ return Response.ok().build();
+ } else if ("RUNNING".equals(newState)) {
sliderAppsViewController.thawApp(appId);
+ return Response.ok().build();
+ }
} else if (requestJson.has("components")) {
Map<String, Integer> componentsMap = new HashMap<String, Integer>();
JsonObject componentsJson = requestJson.get("components")
@@ -106,6 +109,7 @@ public class SliderAppsResource {
componentsMap.put(componentName, instanceCount);
}
sliderAppsViewController.flexApp(appId, componentsMap);
+ return Response.ok().build();
}
}
String sliderApp = sliderAppsViewController
http://git-wip-us.apache.org/repos/asf/ambari/blob/74f138a4/contrib/views/slider/src/main/resources/ui/app/controllers/slider_app_controller.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/controllers/slider_app_controller.js b/contrib/views/slider/src/main/resources/ui/app/controllers/slider_app_controller.js
index 50eafb3..44d1ad9 100644
--- a/contrib/views/slider/src/main/resources/ui/app/controllers/slider_app_controller.js
+++ b/contrib/views/slider/src/main/resources/ui/app/controllers/slider_app_controller.js
@@ -145,7 +145,8 @@ App.SliderAppController = Ember.ObjectController.extend({
name: model.get('name'),
state: "RUNNING"
}
- }
+ },
+ complete: 'thawCompleteCallback'
});
},
@@ -235,7 +236,7 @@ App.SliderAppController = Ember.ObjectController.extend({
},
/**
- * Complate-callback for "destroy app"-request
+ * Complete-callback for "destroy app"-request
* @method destroyCompleteCallback
*/
destroyCompleteCallback: function() {
@@ -243,6 +244,14 @@ App.SliderAppController = Ember.ObjectController.extend({
},
/**
+ * Complete-callback for "thaw app"-request
+ * @method thawCompleteCallback
+ */
+ thawCompleteCallback: function() {
+ this.transitionToRoute('slider_apps');
+ },
+
+ /**
* Create Modal Popup with data for Flex action
* @method showFlexModal
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/74f138a4/contrib/views/slider/src/main/resources/ui/app/mappers/slider_apps_mapper.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/mappers/slider_apps_mapper.js b/contrib/views/slider/src/main/resources/ui/app/mappers/slider_apps_mapper.js
index e751fd6..4734cb0 100644
--- a/contrib/views/slider/src/main/resources/ui/app/mappers/slider_apps_mapper.js
+++ b/contrib/views/slider/src/main/resources/ui/app/mappers/slider_apps_mapper.js
@@ -154,15 +154,7 @@ App.SliderAppsMapper = App.Mapper.createWithMixins(App.RunPeriodically, {
var componentsId = app.components ? self.parseComponents(app) : [],
configs = app.configs ? self.parseConfigs(app) : {},
quickLinks = self.parseQuickLinks(app),
- jmx = self.parseObject(app.jmx),
- masterActiveTime = jmx.findProperty('key', 'MasterActiveTime'),
- masterStartTime = jmx.findProperty('key', 'MasterStartTime');
- if(masterActiveTime){
- masterActiveTime.value = new Date(Date.now() - masterActiveTime.value).getHours() + "h:" + new Date(Date.now() - masterActiveTime.value).getMinutes() + "m";
- }
- if(masterStartTime){
- masterStartTime.value = (new Date(masterStartTime.value).toUTCString());
- }
+ jmx = self.parseObject(app.jmx);
var metricNames = self.parseMetricNames(app);
apps.push(
Ember.Object.create({
http://git-wip-us.apache.org/repos/asf/ambari/blob/74f138a4/contrib/views/slider/src/main/resources/ui/app/views/slider_app/summary_view.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/views/slider_app/summary_view.js b/contrib/views/slider/src/main/resources/ui/app/views/slider_app/summary_view.js
index 02f0b88..07300f7 100644
--- a/contrib/views/slider/src/main/resources/ui/app/views/slider_app/summary_view.js
+++ b/contrib/views/slider/src/main/resources/ui/app/views/slider_app/summary_view.js
@@ -85,29 +85,39 @@ App.SliderAppSummaryView = App.TableView.extend({
var model = this.get('controller.model'),
existingGraphs = this.get('graphs');
if (model) {
+ var currentGraphIds = [];
var supportedMetrics = model.get('supportedMetricNames');
if (supportedMetrics && supportedMetrics.length > 0) {
+ var appId = model.get('id');
supportedMetrics.split(',').forEach(function(metricName) {
- if (!existingGraphs.isAny('id', metricName)) {
+ var graphId = metricName + '_' + appId;
+ currentGraphIds.push(graphId);
+ if (!existingGraphs.isAny('id', graphId)) {
var view = App.AppMetricView.extend({
app: model,
metricName: metricName
});
- existingGraphs.push({id: metricName, view: view});
+ existingGraphs.push({
+ id : graphId,
+ view : view
+ });
}
});
}
-
// Delete not existed graphs
var toDeleteGraphs = [];
existingGraphs.forEach(function(existingGraph) {
- if (supportedMetrics.indexOf(existingGraph) == -1) {
+ if (currentGraphIds.indexOf(existingGraph.id) == -1) {
toDeleteGraphs.push(existingGraph);
}
});
- toDeleteGraphs.forEach(function(toDeleteGraph) {
- existingGraphs = existingGraphs.without(toDeleteGraph);
- });
+ if(toDeleteGraphs.length > 0) {
+ var newGraphs = existingGraphs;
+ toDeleteGraphs.forEach(function(toDeleteGraph) {
+ newGraphs = newGraphs.without(toDeleteGraph);
+ });
+ this.set('graphs', newGraphs);
+ }
}
}.observes('controller.model.supportedMetricNames')
});