} else { if (!_roots.containsKey(p.streamId)) { _roots.put(p.streamId, new InitialReceiver(p.streamId, getSourceOutputFields(context, p.streamId)));
@SuppressWarnings({ "unchecked", "rawtypes" }) public SubtopologyBolt(DefaultDirectedGraph<Node, IndexedEdge> graph, Set<Node> nodes, Map<Node, String> batchGroups) { _nodes = nodes; _graph = (DirectedGraph<Node, IndexedEdge>) graph.clone(); _batchGroups = copyAndOnlyKeep(batchGroups, nodes); //Remove the unneeded entries from the graph //We want to keep all of our nodes, and the nodes that they are connected directly to (parents and children). Set<Node> nodesToKeep = new HashSet<>(); for (IndexedEdge edge : _graph.edgeSet()) { Node s = _graph.getEdgeSource(edge); Node t = _graph.getEdgeTarget(edge); if (_nodes.contains(s) || _nodes.contains(t)) { nodesToKeep.add(s); nodesToKeep.add(t); } } Set<Node> nodesToRemove = new HashSet<>(_graph.vertexSet()); nodesToRemove.removeAll(nodesToKeep); _graph.removeAllVertices(nodesToRemove); }
Number cpuLoad = groupRes.get(Config.TOPOLOGY_COMPONENT_CPU_PCORE_PERCENT); BoltDeclarer d = builder.setBolt(boltIds.get(g), new SubtopologyBolt(graph, g.nodes, batchGroupMap), p, committerBatches(g, batchGroupMap), streamToGroup);
Number cpuLoad = groupRes.get(Config.TOPOLOGY_COMPONENT_CPU_PCORE_PERCENT); BoltDeclarer d = builder.setBolt(boltIds.get(g), new SubtopologyBolt(graph, g.nodes, batchGroupMap), p, committerBatches(g, batchGroupMap), streamToGroup);
} else { if(!_roots.containsKey(p.streamId)) { _roots.put(p.streamId, new InitialReceiver(p.streamId, getSourceOutputFields(context, p.streamId)));