incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cr...@apache.org
Subject git commit: Switched the controller checking to the new online call
Date Wed, 16 Oct 2013 04:20:46 GMT
Updated Branches:
  refs/heads/blur-console-v2 3357a4f92 -> 629009eff


Switched the controller checking to the new online call


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/629009ef
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/629009ef
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/629009ef

Branch: refs/heads/blur-console-v2
Commit: 629009eff6fbd0788c8bbcf13cabb801680b55fc
Parents: 3357a4f
Author: Chris Rohr <crohr@nearinfinity.com>
Authored: Wed Oct 16 00:20:37 2013 -0400
Committer: Chris Rohr <crohr@nearinfinity.com>
Committed: Wed Oct 16 00:20:37 2013 -0400

----------------------------------------------------------------------
 .../org/apache/blur/console/util/NodeUtil.java  | 31 ++++++++++----------
 .../apache/blur/console/webapp/js/directives.js |  4 ++-
 .../console/webapp/partials/dashboard.tpl.html  | 23 ++++++++++++---
 3 files changed, 38 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/629009ef/contrib/blur-console/src/main/java/org/apache/blur/console/util/NodeUtil.java
----------------------------------------------------------------------
diff --git a/contrib/blur-console/src/main/java/org/apache/blur/console/util/NodeUtil.java
b/contrib/blur-console/src/main/java/org/apache/blur/console/util/NodeUtil.java
index 2029cc3..a0ac42c 100644
--- a/contrib/blur-console/src/main/java/org/apache/blur/console/util/NodeUtil.java
+++ b/contrib/blur-console/src/main/java/org/apache/blur/console/util/NodeUtil.java
@@ -33,10 +33,7 @@ import java.util.Map;
 import java.util.Set;
 
 import org.apache.blur.manager.clusterstatus.ZookeeperClusterStatus;
-import org.apache.blur.thrift.BlurClient;
-import org.apache.blur.thrift.generated.Blur.Iface;
 import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang.StringUtils;
 import org.json.JSONException;
 
 public class NodeUtil {
@@ -45,23 +42,17 @@ public class NodeUtil {
 		ZookeeperClusterStatus zk = new ZookeeperClusterStatus(Config.getBlurConfig().get("blur.zookeeper.connection"),
 				Config.getBlurConfig());
 
-		// TODO: Fix with another call, this will return online only every time
 		List<String> allControllers = new ArrayList<String>();
+		List<String> oControllers = new ArrayList<String>();
 		try {
-			allControllers = zk.getControllerServerList();
+			allControllers = zk.getOnlineControllerList();
+			oControllers = zk.getControllerServerList();
 		} finally {
 			zk.close();
 		}
-
-		Iface client = BlurClient.getClient(StringUtils.join(allControllers, ","));
-		List<String> controllersFromBlur = new ArrayList<String>();
-		try {
-			controllersFromBlur = client.controllerServerList();
-		} catch (Exception e) {
-		}
 		
-		Collection<String> onlineControllers = CollectionUtils.intersection(allControllers,
controllersFromBlur);
-		Collection<String> offlineControllers = CollectionUtils.subtract(allControllers,
controllersFromBlur);
+		Collection<String> onlineControllers = CollectionUtils.intersection(allControllers,
oControllers);
+		Collection<String> offlineControllers = CollectionUtils.subtract(allControllers,
oControllers);
 
 		Map<String, Object> data = new HashMap<String, Object>();
 
@@ -85,6 +76,10 @@ public class NodeUtil {
 
 		data.put("chart", chartData);
 		
+		if (allControllers.isEmpty()) {
+			data.put("errmsg", "Unable to find any nodes");
+		}
+		
 		return data;
 	}
 
@@ -121,6 +116,9 @@ public class NodeUtil {
 				clusterData.add(online);
 				clusterData.add(offline);
 				clusterObj.put("chart", clusterData);
+				if (offlineShardServers.isEmpty() && onlineShardServers.isEmpty()) {
+					clusterObj.put("errmsg", "Unable to find any nodes for cluster [" + cluster + "]");
+				}
 	
 				data.add(clusterObj);
 			}
@@ -169,7 +167,6 @@ public class NodeUtil {
 				question.close();
 			} catch (Exception e) {
 				offlineZookeepers.add(connection);
-				//log.error("A connection to " + connection + " could not be made.", e);
 			}
 		}
 		
@@ -195,6 +192,10 @@ public class NodeUtil {
 
 		data.put("chart", chartData);
 		
+		if (onlineZookeepers.isEmpty() && offlineZookeepers.isEmpty()) {
+			data.put("errmsg", "Unable to find any nodes");
+		}
+		
 		return data;
 	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/629009ef/contrib/blur-console/src/main/resources/org/apache/blur/console/webapp/js/directives.js
----------------------------------------------------------------------
diff --git a/contrib/blur-console/src/main/resources/org/apache/blur/console/webapp/js/directives.js
b/contrib/blur-console/src/main/resources/org/apache/blur/console/webapp/js/directives.js
index dba4d40..5f06802 100644
--- a/contrib/blur-console/src/main/resources/org/apache/blur/console/webapp/js/directives.js
+++ b/contrib/blur-console/src/main/resources/org/apache/blur/console/webapp/js/directives.js
@@ -20,7 +20,8 @@ blurApp.directive('piechart', ['flotrService', '$window', function(flotrService,
 		restrict: 'EA',
 		scope: {
 			chartdata: '=',
-			title: '@'
+			title: '@',
+			subtitle: '@'
 		},
 		link: function(scope, element, attrs) {
 			flotrService.flotr().then(function(Flotr) {
@@ -55,6 +56,7 @@ blurApp.directive('piechart', ['flotrService', '$window', function(flotrService,
 					Flotr.draw(element[0], data, {
 						HtmlText: false,
 						title: scope.title,
+						subtitle: scope.subtitle,
 						grid: {
 							verticalLines: false,
 							horizontalLines: false,

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/629009ef/contrib/blur-console/src/main/resources/org/apache/blur/console/webapp/partials/dashboard.tpl.html
----------------------------------------------------------------------
diff --git a/contrib/blur-console/src/main/resources/org/apache/blur/console/webapp/partials/dashboard.tpl.html
b/contrib/blur-console/src/main/resources/org/apache/blur/console/webapp/partials/dashboard.tpl.html
index 6c47ccb..b5060b8 100644
--- a/contrib/blur-console/src/main/resources/org/apache/blur/console/webapp/partials/dashboard.tpl.html
+++ b/contrib/blur-console/src/main/resources/org/apache/blur/console/webapp/partials/dashboard.tpl.html
@@ -21,15 +21,25 @@ Licensed to the Apache Software Foundation (ASF) under one
 <div ng-controller="DashboardCtrl">
     <div id="slow-query-warnings" class="alert alert-danger hidden">Warning</div>
     <div class="row">
-        <div class="col-md-7">
+        <div class="col-md-8">
             <div class="row">
                 <div class="col-md-6 center">
                     <h4>Zookeepers</h4>
-                    <div piechart chartdata="nodeData.zookeepers.chart"></div>
+                    <div ng-if="!nodeData.zookeepers.errmsg">
+                        <div piechart chartdata="nodeData.zookeepers.chart"></div>
+                    </div>
+                    <div ng-if="nodeData.zookeepers.errmsg">
+                        <div class="alert alert-danger">{{nodeData.zookeepers.errmsg}}</div>
+                    </div>
                 </div>
                 <div class="col-md-6 center">
                     <h4>Controllers</h4>
-                    <div piechart chartdata="nodeData.controllers.chart"></div>
+                    <div ng-if="!nodeData.controllers.errmsg">
+                        <div piechart chartdata="nodeData.controllers.chart"></div>
+                    </div>
+                    <div ng-if="nodeData.controllers.errmsg">
+                        <div class="alert alert-danger">{{nodeData.controllers.errmsg}}</div>
+                    </div>
                 </div>
             </div>
             <div class="row">
@@ -48,7 +58,12 @@ Licensed to the Apache Software Foundation (ASF) under one
                 <div class="col-md-12 center">
                     <h4>Shards</h4>
                     <div ng-repeat="cluster in nodeData.clusters" style="text-align:center">
-                        <div piechart chartdata="cluster.chart" title="{{cluster.name}}"></div>
+                        <div ng-if="!cluster.errmsg">
+                            <div piechart chartdata="cluster.chart" title="{{cluster.name}}"></div>
+                        </div>
+                        <div ng-if="cluster.errmsg">
+                            <div class="alert alert-danger">{{cluster.errmsg}}</div>
+                        </div>
                     </div>
                 </div>
             </div>


Mime
View raw message