Fix the summary/history API, update docs, add cleaner
Project: http://git-wip-us.apache.org/repos/asf/storm/repo Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/a3726a9a Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/a3726a9a Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/a3726a9a Branch: refs/heads/master Commit: a3726a9a4d2d1e194c90c4d3d1837af004b177f7 Parents: 18abd03 Author: zhuol <[email protected]> Authored: Thu Nov 5 14:28:28 2015 -0600 Committer: zhuol <[email protected]> Committed: Mon Nov 9 11:51:09 2015 -0600 ---------------------------------------------------------------------- docs/documentation/ui-rest-api.md | 6 +++--- storm-core/src/clj/backtype/storm/daemon/nimbus.clj | 8 ++++++++ storm-core/src/clj/backtype/storm/ui/core.clj | 3 +-- storm-core/src/ui/public/deep_search_result.html | 8 ++++---- 4 files changed, 16 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/storm/blob/a3726a9a/docs/documentation/ui-rest-api.md ---------------------------------------------------------------------- diff --git a/docs/documentation/ui-rest-api.md b/docs/documentation/ui-rest-api.md index 1716cc9..e1c68c1 100644 --- a/docs/documentation/ui-rest-api.md +++ b/docs/documentation/ui-rest-api.md @@ -174,7 +174,7 @@ Sample response: ### /api/v1/history/summary (GET) -Returns a list of topology ID submitted by the current user. +Returns a list of all running topologies' IDs submitted by the current user. Response fields: @@ -187,8 +187,8 @@ Sample response: ```json { "topo-history":[ - {"host":"wc6-1-1446571009"}, - {"host":"wc8-2-1446587178"} + "wc6-1-1446571009", + "wc8-2-1446587178" ] } ``` http://git-wip-us.apache.org/repos/asf/storm/blob/a3726a9a/storm-core/src/clj/backtype/storm/daemon/nimbus.clj ---------------------------------------------------------------------- diff --git a/storm-core/src/clj/backtype/storm/daemon/nimbus.clj b/storm-core/src/clj/backtype/storm/daemon/nimbus.clj index dddfbc9..78b748f 100644 --- a/storm-core/src/clj/backtype/storm/daemon/nimbus.clj +++ b/storm-core/src/clj/backtype/storm/daemon/nimbus.clj @@ -1265,6 +1265,14 @@ (fn [] (clean-inbox (inbox nimbus) (conf NIMBUS-INBOX-JAR-EXPIRATION-SECS)) )) + ;; Schedule topology history cleaner + (when-let [interval (conf LOGVIEWER-CLEANUP-INTERVAL-SECS)] + (schedule-recurring (:timer nimbus) + 0 + (conf LOGVIEWER-CLEANUP-INTERVAL-SECS) + (fn [] + (clean-topology-history (conf LOGVIEWER-CLEANUP-AGE-MINS) nimbus) + ))) ;;schedule nimbus code sync thread to sync code from other nimbuses. (schedule-recurring (:timer nimbus) 0 http://git-wip-us.apache.org/repos/asf/storm/blob/a3726a9a/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 e0bd669..1f36c28 100644 --- a/storm-core/src/clj/backtype/storm/ui/core.clj +++ b/storm-core/src/clj/backtype/storm/ui/core.clj @@ -356,8 +356,7 @@ (topology-history-info (.getTopologyHistory ^Nimbus$Client nimbus user) user))) ([history user] {"topo-history" - (for [^String s (.get_topo_ids history)] - {"host" s})})) + (into [] (.get_topo_ids history))})) (defn cluster-summary ([user] http://git-wip-us.apache.org/repos/asf/storm/blob/a3726a9a/storm-core/src/ui/public/deep_search_result.html ---------------------------------------------------------------------- diff --git a/storm-core/src/ui/public/deep_search_result.html b/storm-core/src/ui/public/deep_search_result.html index 30d54d1..406a101 100644 --- a/storm-core/src/ui/public/deep_search_result.html +++ b/storm-core/src/ui/public/deep_search_result.html @@ -65,10 +65,10 @@ $(document).ready(function() { var findIds = function findIds(query, cb) { var found = []; var re = new RegExp(query, 'i'); - for (var i in response["topo-history"]) { - var host = response["topo-history"][i].host; - if (re.test(host)) { - found.push({ value: host }); + for (var j in response["topo-history"]) { + var id = response["topo-history"][j]; + if (re.test(id)) { + found.push({ value: id }); } } cb(found);
