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/11/20 23:26:31 UTC
[06/15] storm git commit: Add schedulerDisplayResource REST API,
which the resource hiding/display is based
Add schedulerDisplayResource REST API, which the resource hiding/display is based
Add one rest for topo/id, delete the last REST getJSON call
Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/515722df
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/515722df
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/515722df
Branch: refs/heads/master
Commit: 515722dfdee7f5881b219f81263064b16d2f38a6
Parents: 89fff44
Author: zhuol <zh...@yahoo-inc.com>
Authored: Wed Nov 18 13:50:57 2015 -0600
Committer: zhuol <zh...@yahoo-inc.com>
Committed: Thu Nov 19 12:39:27 2015 -0600
----------------------------------------------------------------------
docs/documentation/ui-rest-api.md | 4 ++++
storm-core/src/clj/backtype/storm/ui/core.clj | 9 ++++++---
storm-core/src/ui/public/index.html | 14 --------------
.../src/ui/public/templates/index-page-template.html | 12 ++++++++++++
storm-core/src/ui/public/topology.html | 12 +++++-------
5 files changed, 27 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/storm/blob/515722df/docs/documentation/ui-rest-api.md
----------------------------------------------------------------------
diff --git a/docs/documentation/ui-rest-api.md b/docs/documentation/ui-rest-api.md
index f2d36a9..1fabcf5 100644
--- a/docs/documentation/ui-rest-api.md
+++ b/docs/documentation/ui-rest-api.md
@@ -143,6 +143,7 @@ Sample response:
"usedCPU": 160
}
]
+ "schedulerDisplayResource": true
}
```
@@ -252,6 +253,7 @@ Sample response:
"assignedCpu": 80
}
]
+ "schedulerDisplayResource": true
}
```
@@ -315,6 +317,7 @@ Response fields:
|executorsTotal| Integer |Number of executors used for this topology|
|msgTimeout| Integer | Number of seconds a tuple has before the spout considers it failed |
|windowHint| String | window param value in "hh mm ss" format. Default value is "All Time"|
+|schedulerDisplayResource| Boolean | Whether to display scheduler resource information|
|topologyStats| Array | Array of all the topology related stats per time window|
|topologyStats.windowPretty| String |Duration passed in HH:MM:SS format|
|topologyStats.window| String |User requested time window for metrics|
@@ -373,6 +376,7 @@ Sample response:
"uptimeSeconds": 1759,
"msgTimeout": 30,
"windowHint": "10m 0s",
+ "schedulerDisplayResource": true,
"topologyStats": [
{
"windowPretty": "10m 0s",
http://git-wip-us.apache.org/repos/asf/storm/blob/515722df/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 480dcd3..cc6632a 100644
--- a/storm-core/src/clj/backtype/storm/ui/core.clj
+++ b/storm-core/src/clj/backtype/storm/ui/core.clj
@@ -438,7 +438,8 @@
"totalCpu" (get (.get_total_resources s) Config/SUPERVISOR_CPU_CAPACITY)
"usedMem" (.get_used_mem s)
"usedCpu" (.get_used_cpu s)
- "version" (.get_version s)})}))
+ "version" (.get_version s)})
+ "schedulerDisplayResource" (*STORM-CONF* Config/SCHEDULER_DISPLAY_RESOURCE)}))
(defn all-topologies-summary
([]
@@ -469,7 +470,8 @@
"assignedMemOnHeap" (.get_assigned_memonheap t)
"assignedMemOffHeap" (.get_assigned_memoffheap t)
"assignedTotalMem" (+ (.get_assigned_memonheap t) (.get_assigned_memoffheap t))
- "assignedCpu" (.get_assigned_cpu t)})}))
+ "assignedCpu" (.get_assigned_cpu t)})
+ "schedulerDisplayResource" (*STORM-CONF* Config/SCHEDULER_DISPLAY_RESOURCE)}))
(defn topology-stats [window stats]
(let [times (stats-times (:emitted stats))
@@ -633,7 +635,8 @@
"windowHint" window-hint
"msgTimeout" msg-timeout
"configuration" topology-conf
- "visualizationTable" []}))))
+ "visualizationTable" []
+ "schedulerDisplayResource" (*STORM-CONF* Config/SCHEDULER_DISPLAY_RESOURCE)}))))
(defn component-errors
[errors-list topology-id secure?]
http://git-wip-us.apache.org/repos/asf/storm/blob/515722df/storm-core/src/ui/public/index.html
----------------------------------------------------------------------
diff --git a/storm-core/src/ui/public/index.html b/storm-core/src/ui/public/index.html
index 454fe64..eae423c 100644
--- a/storm-core/src/ui/public/index.html
+++ b/storm-core/src/ui/public/index.html
@@ -143,12 +143,6 @@ $(document).ready(function() {
]
});
$('#topology-summary [data-toggle="tooltip"]').tooltip();
- $.getJSON("/api/v1/cluster/configuration", function(json){
- var displayResource = json["scheduler.display.resource"];
- if (!displayResource){
- $('#topology-summary td:nth-child(10),#topology-summary th:nth-child(10)').hide();
- }
- });
});
});
$.getJSON("/api/v1/supervisor/summary",function(response,status,jqXHR) {
@@ -162,14 +156,6 @@ $(document).ready(function() {
]
});
$('#supervisor-summary [data-toggle="tooltip"]').tooltip();
- $.getJSON("/api/v1/cluster/configuration", function(json){
- var displayResource = json["scheduler.display.resource"];
- if (!displayResource){
- $('#supervisor-summary td:nth-child(6),#supervisor-summary th:nth-child(6)').hide();
- $('#supervisor-summary td:nth-child(8),#supervisor-summary th:nth-child(8)').hide();
- $('#supervisor-summary td:nth-child(9),#supervisor-summary th:nth-child(9)').hide();
- }
- });
});
});
$.getJSON("/api/v1/cluster/configuration",function(response,status,jqXHR) {
http://git-wip-us.apache.org/repos/asf/storm/blob/515722df/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 bf1f108..5173356 100644
--- a/storm-core/src/ui/public/templates/index-page-template.html
+++ b/storm-core/src/ui/public/templates/index-page-template.html
@@ -154,11 +154,13 @@
Assigned Mem (MB)
</span>
</th>
+ {{#schedulerDisplayResource}}
<th>
<span data-toggle="tooltip" data-placement="above" title="Assigned Total CPU by Scheduler. Every 100 means 1 core.">
Assigned CPU (%)
</span>
</th>
+ {{/schedulerDisplayResource}}
<th>
<span data-toggle="tooltip" data-placement="left" title="This shows information from the scheduler about the latest attempt to schedule the Topology on the cluster.">
Scheduler Info
@@ -178,7 +180,9 @@
<td>{{tasksTotal}}</td>
<td>{{replicationCount}}</td>
<td>{{assignedTotalMem}}</td>
+ {{#schedulerDisplayResource}}
<td>{{assignedCpu}}</td>
+ {{/schedulerDisplayResource}}
<td>{{schedulerInfo}}</td>
</tr>
{{/topologies}}
@@ -214,16 +218,19 @@
Used slots
</span>
</th>
+ {{#schedulerDisplayResource}}
<th>
<span data-toggle="tooltip" data-placement="above" title="Memory capacity of a supervisor.">
Total Mem (MB)
</span>
</th>
+ {{/schedulerDisplayResource}}
<th>
<span data-toggle="tooltip" data-placement="left" title="Memory that has been allocated.">
Used Mem (MB)
</span>
</th>
+ {{#schedulerDisplayResource}}
<th>
<span data-toggle="tooltip" data-placement="above" title="CPU capacity of a supervisor. Every 100 means one core.">
Total CPU (%)
@@ -234,6 +241,7 @@
Used CPU (%)
</span>
</th>
+ {{/schedulerDisplayResource}}
<th>
<span data-toggle="tooltip" data-placement="left" title="Version">
Version
@@ -249,10 +257,14 @@
<td>{{uptime}}</td>
<td>{{slotsTotal}}</td>
<td>{{slotsUsed}}</td>
+ {{#schedulerDisplayResource}}
<td>{{totalMem}}</td>
+ {{/schedulerDisplayResource}}
<td>{{usedMem}}</td>
+ {{#schedulerDisplayResource}}
<td>{{totalCpu}}</td>
<td>{{usedCpu}}</td>
+ {{/schedulerDisplayResource}}
<td>{{version}}</td>
</tr>
{{/supervisors}}
http://git-wip-us.apache.org/repos/asf/storm/blob/515722df/storm-core/src/ui/public/topology.html
----------------------------------------------------------------------
diff --git a/storm-core/src/ui/public/topology.html b/storm-core/src/ui/public/topology.html
index c5b8684..5869d9a 100644
--- a/storm-core/src/ui/public/topology.html
+++ b/storm-core/src/ui/public/topology.html
@@ -293,13 +293,11 @@ $(document).ready(function() {
searchForm.append(Mustache.render($(template).filter("#search-form-template").html(),{id: topologyId}));
topologySummary.append(Mustache.render($(template).filter("#topology-summary-template").html(),response));
topologyResources.append(Mustache.render($(template).filter("#topology-resources-template").html(),response));
- $.getJSON("/api/v1/cluster/configuration", function(json){
- var displayResource = json["scheduler.display.resource"];
- if (!displayResource){
- $('#topology-resources-header').hide();
- $('#topology-resources').hide();
- }
- });
+ var displayResource = response["schedulerDisplayResource"];
+ if (!displayResource){
+ $('#topology-resources-header').hide();
+ $('#topology-resources').hide();
+ }
topologyActions.append(Mustache.render($(template).filter("#topology-actions-template").html(),buttonJsonData));
topologyStats.append(Mustache.render($(template).filter("#topology-stats-template").html(),response));
//window, emitted, transferred, complete latency, acked, failed