You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by bo...@apache.org on 2015/08/24 15:52:27 UTC
[42/50] [abbrv] storm git commit: modifed ui to reflect dead nimbus
hosts based on nimbus.seeds.
modifed ui to reflect dead nimbus hosts based on nimbus.seeds.
Conflicts:
storm-core/src/jvm/backtype/storm/utils/NimbusClient.java
Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/16293e46
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/16293e46
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/16293e46
Branch: refs/heads/master
Commit: 16293e46f9b32bb495067217a721fe720a488975
Parents: 3f66ffd
Author: Parth Brahmbhatt <br...@gmail.com>
Authored: Thu Apr 9 11:57:19 2015 -0700
Committer: Parth Brahmbhatt <br...@gmail.com>
Committed: Wed Aug 12 09:29:35 2015 -0700
----------------------------------------------------------------------
STORM-UI-REST-API.md | 3 +-
storm-core/src/clj/backtype/storm/cluster.clj | 2 ++
storm-core/src/clj/backtype/storm/ui/core.clj | 34 ++++++++++++++------
.../jvm/backtype/storm/utils/NimbusClient.java | 30 ++++++++++-------
.../public/templates/index-page-template.html | 5 +--
5 files changed, 51 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/storm/blob/16293e46/STORM-UI-REST-API.md
----------------------------------------------------------------------
diff --git a/STORM-UI-REST-API.md b/STORM-UI-REST-API.md
index 35ba6ed..a8f2bd1 100644
--- a/STORM-UI-REST-API.md
+++ b/STORM-UI-REST-API.md
@@ -148,6 +148,7 @@ Response fields:
|--- |--- |---
|host| String | Nimbus' host name|
|port| int| Nimbus' port number|
+|status| String| Possible values are Leader, Not a Leader, Dead|
|nimbusUpTime| String| Shows since how long the nimbus has been running|
|nimbusLogLink| String| Logviewer url to view the nimbus.log|
|version| String| Version of storm this nimbus host is running|
@@ -161,7 +162,7 @@ Sample response:
"host":"192.168.202.1",
"port":6627,
"nimbusLogLink":"http:\/\/192.168.202.1:8000\/log?file=nimbus.log",
- "isLeader":true,
+ "status":Leader,
"version":"0.10.0-SNAPSHOT",
"nimbusUpTime":"3m 33s"
}
http://git-wip-us.apache.org/repos/asf/storm/blob/16293e46/storm-core/src/clj/backtype/storm/cluster.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/backtype/storm/cluster.clj b/storm-core/src/clj/backtype/storm/cluster.clj
index 15af1b0..65cdb47 100644
--- a/storm-core/src/clj/backtype/storm/cluster.clj
+++ b/storm-core/src/clj/backtype/storm/cluster.clj
@@ -366,6 +366,8 @@
(add-nimbus-host!
[this nimbus-id nimbus-summary]
+ ;explicit delete for ephmeral node to ensure this session creates the entry.
+ (delete-node cluster-state (nimbus-path nimbus-id))
(set-ephemeral-node cluster-state (nimbus-path nimbus-id) (Utils/serialize nimbus-summary) acls))
(code-distributor-info
http://git-wip-us.apache.org/repos/asf/storm/blob/16293e46/storm-core/src/clj/backtype/storm/ui/core.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/backtype/storm/ui/core.clj b/storm-core/src/clj/backtype/storm/ui/core.clj
index 950b88d..40d030f 100644
--- a/storm-core/src/clj/backtype/storm/ui/core.clj
+++ b/storm-core/src/clj/backtype/storm/ui/core.clj
@@ -570,21 +570,37 @@
"executorsTotal" total-executors
"tasksTotal" total-tasks })))
+(defn convert-to-nimbus-summary[nimbus-seed]
+ (let [[host port] (.split nimbus-seed ":")]
+ {
+ "host" host
+ "port" port
+ "nimbusLogLink" (nimbus-log-link host port)
+ "status" "Offline"
+ "version" "Not applicable"
+ "nimbusUpTime" "Not applicable"}
+ ))
+
(defn nimbus-summary
([]
(thrift/with-configured-nimbus-connection nimbus
(nimbus-summary
(.get_nimbuses (.getClusterInfo ^Nimbus$Client nimbus)))))
([nimbuses]
- {"nimbuses"
- (for [^NimbusSummary n nimbuses]
- {
- "host" (.get_host n)
- "port" (.get_port n)
- "nimbusLogLink" (nimbus-log-link (.get_host n) (.get_port n))
- "isLeader" (.is_isLeader n)
- "version" (.get_version n)
- "nimbusUpTime" (pretty-uptime-sec (.get_uptime_secs n))})}))
+ (let [nimbus-seeds (set (*STORM-CONF* NIMBUS-SEEDS))
+ alive-nimbuses (set (map #(str (.get_host %1) ":" (.get_port %1)) nimbuses))
+ dead-nimbuses (clojure.set/difference nimbus-seeds alive-nimbuses)
+ dead-nimbuses-summary (map #(convert-to-nimbus-summary %1) dead-nimbuses)]
+ {"nimbuses"
+ (concat dead-nimbuses-summary
+ (for [^NimbusSummary n nimbuses]
+ {
+ "host" (.get_host n)
+ "port" (.get_port n)
+ "nimbusLogLink" (nimbus-log-link (.get_host n) (.get_port n))
+ "status" (if (.is_isLeader n) "Leader" "Not a Leader")
+ "version" (.get_version n)
+ "nimbusUpTime" (pretty-uptime-sec (.get_uptime_secs n))}))})))
(defn supervisor-summary
([]
http://git-wip-us.apache.org/repos/asf/storm/blob/16293e46/storm-core/src/jvm/backtype/storm/utils/NimbusClient.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/backtype/storm/utils/NimbusClient.java b/storm-core/src/jvm/backtype/storm/utils/NimbusClient.java
index 60fa3aa..323d2a8 100644
--- a/storm-core/src/jvm/backtype/storm/utils/NimbusClient.java
+++ b/storm-core/src/jvm/backtype/storm/utils/NimbusClient.java
@@ -38,6 +38,7 @@ import java.util.List;
import java.util.Map;
public class NimbusClient extends ThriftClient {
+ public static final String DELIMITER = ":";
private Nimbus.Client _client;
private static final Logger LOG = LoggerFactory.getLogger(NimbusClient.class);
@@ -63,25 +64,32 @@ public class NimbusClient extends ThriftClient {
}
for(String seed : seeds) {
- String[] split = seed.split(":");
+ String[] split = seed.split(DELIMITER);
String host = split[0];
int port = Integer.parseInt(split[1]);
+ ClusterSummary clusterInfo = null;
try {
NimbusClient client = new NimbusClient(conf, host, port);
- ClusterSummary clusterInfo = client.getClient().getClusterInfo();
- List<NimbusSummary> nimbuses = clusterInfo.get_nimbuses();
- if (nimbuses != null) {
- for (NimbusSummary nimbusSummary : nimbuses) {
- if (nimbusSummary.is_isLeader()) {
+ clusterInfo = client.getClient().getClusterInfo();
+ } catch (Exception e) {
+ LOG.warn("Ignoring exception while trying to get leader nimbus info from " + seed
+ + ". will retry with a different seed host.", e);
+ continue;
+ }
+ List<NimbusSummary> nimbuses = clusterInfo.get_nimbuses();
+ if (nimbuses != null) {
+ for (NimbusSummary nimbusSummary : nimbuses) {
+ if (nimbusSummary.is_isLeader()) {
+ try {
return new NimbusClient(conf, nimbusSummary.get_host(), nimbusSummary.get_port(), null, asUser);
+ } catch (TTransportException e) {
+ String leaderNimbus = nimbusSummary.get_host() + DELIMITER + nimbusSummary.get_port();
+ throw new RuntimeException("Failed to create a nimbus client for the leader " + leaderNimbus, e);
}
}
- throw new RuntimeException("Found nimbuses " + nimbuses + " none of which is elected as leader, please try " +
- "again after some time.");
}
- } catch (Exception e) {
- LOG.warn("Ignoring exception while trying to get leader nimbus info from " + seed
- + ". will retry with a different seed host.", e);
+ throw new RuntimeException("Found nimbuses " + nimbuses + " none of which is elected as leader, please try " +
+ "again after some time.");
}
}
throw new RuntimeException("Could not find leader nimbus from seed hosts " + seeds + ". " +
http://git-wip-us.apache.org/repos/asf/storm/blob/16293e46/storm-core/src/ui/public/templates/index-page-template.html
----------------------------------------------------------------------
diff --git a/storm-core/src/ui/public/templates/index-page-template.html b/storm-core/src/ui/public/templates/index-page-template.html
index 37c1aac..1e585ff 100644
--- a/storm-core/src/ui/public/templates/index-page-template.html
+++ b/storm-core/src/ui/public/templates/index-page-template.html
@@ -80,7 +80,8 @@
<span data-toggle="tooltip" data-placement="above" title="Nimbus Thrift port number.">Port</span>
</th>
<th>
- <span data-toggle="tooltip" data-placement="above" title="True if this host is leader, false otherwise.">IsLeader</span>
+ <span data-toggle="tooltip" data-placement="above" title="Leader if this host is leader, Not a Leader for all other live hosts,
+ note that these hosts may or may not be in leader lock queue, and Dead for hosts that are part of nimbus.seeds list but are not alive.">Status</span>
</th>
<th>
<span data-toggle="tooltip" data-placement="above" title="Storm version this nimbus host is running.">Version</span>
@@ -95,7 +96,7 @@
<tr>
<td>{{host}}</td>
<td><a href="{{nimbusLogLink}}">{{port}}</a></td>
- <td>{{isLeader}}</td>
+ <td>{{status}}</td>
<td>{{version}}</td>
<td>{{nimbusUpTime}}</td>
</tr>