Ethanlm commented on a change in pull request #3011: STORM-3395 Fix Placeholder
Topology page components show task counts
URL: https://github.com/apache/storm/pull/3011#discussion_r289047024
##########
File path:
storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java
##########
@@ -4214,6 +4203,31 @@ private void
maybeAddPlaceholderBoltAggStats(TopologyPageInfo topoPageInfo, Stor
}
}
+ private CommonAggregateStats getPlaceholderCommonAggregateStats(Object
component) {
+ // common aggregate
+ CommonAggregateStats commonStats = new CommonAggregateStats();
+
+ // get num_executors
+ int numExecutors = 0;
+ try {
+ numExecutors = StormCommon.numStartExecutors(component);
+ } catch (InvalidTopologyException e) {
+ // ignore
+ }
+
+ // get num_tasks
+ Map<String, Object> jsonMap = StormCommon.componentConf(component);
+ int numTasks = (int) (long)
jsonMap.getOrDefault(Config.TOPOLOGY_TASKS, 0);
Review comment:
Why do we need to cast twice: `(int) (long) `? Also it's probably better to
have
`jsonMap.getOrDefault(Config.TOPOLOGY_TASKS, numExecutors);`. But in theory,
`TOPOLOGY_TASKS` will be set during submission if it's not specified by the
topology. So it should be fine.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services