Github user d2r commented on a diff in the pull request:
https://github.com/apache/storm/pull/921#discussion_r47962606
--- Diff:
storm-core/src/jvm/backtype/storm/scheduler/resource/ResourceUtils.java ---
@@ -130,4 +137,57 @@ private static void debugMessage(String memoryType,
String Com, Map topologyConf
Com,
topologyConf.get(Config.TOPOLOGY_COMPONENT_CPU_PCORE_PERCENT));
}
}
+
+ /**
+ * print scheduling for debug purposes
+ * @param cluster
+ * @param topologies
+ */
+ public static String printScheduling(Cluster cluster, Topologies
topologies) {
+ StringBuilder str = new StringBuilder();
+ Map<String, Map<String, Map<WorkerSlot,
Collection<ExecutorDetails>>>> schedulingMap = new HashMap<String, Map<String,
Map<WorkerSlot, Collection<ExecutorDetails>>>>();
+ for (TopologyDetails topo : topologies.getTopologies()) {
+ if (cluster.getAssignmentById(topo.getId()) != null) {
+ for (Map.Entry<ExecutorDetails, WorkerSlot> entry :
cluster.getAssignmentById(topo.getId()).getExecutorToSlot().entrySet()) {
+ WorkerSlot slot = entry.getValue();
+ String nodeId = slot.getNodeId();
+ ExecutorDetails exec = entry.getKey();
+ if (schedulingMap.containsKey(nodeId) == false) {
+ schedulingMap.put(nodeId, new HashMap<String,
Map<WorkerSlot, Collection<ExecutorDetails>>>());
+ }
+ if
(schedulingMap.get(nodeId).containsKey(topo.getId()) == false) {
+ schedulingMap.get(nodeId).put(topo.getId(), new
HashMap<WorkerSlot, Collection<ExecutorDetails>>());
+ }
+ if
(schedulingMap.get(nodeId).get(topo.getId()).containsKey(slot) == false) {
+
schedulingMap.get(nodeId).get(topo.getId()).put(slot, new
LinkedList<ExecutorDetails>());
+ }
+
schedulingMap.get(nodeId).get(topo.getId()).get(slot).add(exec);
+ }
+ }
+ }
+
+ for (Map.Entry<String, Map<String, Map<WorkerSlot,
Collection<ExecutorDetails>>>> entry : schedulingMap.entrySet()) {
+ if (cluster.getSupervisorById(entry.getKey()) != null) {
+ str.append("/** Node: " +
cluster.getSupervisorById(entry.getKey()).getHost() + "-" + entry.getKey() + "
**/\n");
+ } else {
+ str.append("/** Node: Unknown may be dead -" +
entry.getKey() + " **/\n");
+ }
+ for (Map.Entry<String, Map<WorkerSlot,
Collection<ExecutorDetails>>> topo_sched :
schedulingMap.get(entry.getKey()).entrySet()) {
+ str.append("\t-->Topology: " + topo_sched.getKey() + "\n");
+ for (Map.Entry<WorkerSlot, Collection<ExecutorDetails>> ws
: topo_sched.getValue().entrySet()) {
+ str.append("\t\t->Slot [" + ws.getKey().getPort() + "]
-> " + ws.getValue() + "\n");
+ }
+ }
+ }
+ return str.toString();
+ }
+
+ public static String printScheduling(RAS_Nodes nodes) {
+ String ret="";
+ for (RAS_Node node : nodes.getNodes()) {
+ ret += "Node: " + node.getHostname() + "\n";
+ ret += "-> " + node.getTopoIdTousedSlots() + "\n";
+ }
+ return ret;
+ }
--- End diff --
This is not used. Should we keep it?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---