Github user rfarivar commented on a diff in the pull request:
https://github.com/apache/storm/pull/921#discussion_r47691091
--- Diff:
storm-core/src/jvm/backtype/storm/scheduler/resource/RAS_Nodes.java ---
@@ -0,0 +1,159 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package backtype.storm.scheduler.resource;
+
+import backtype.storm.Config;
+import backtype.storm.scheduler.Cluster;
+import backtype.storm.scheduler.ExecutorDetails;
+import backtype.storm.scheduler.SchedulerAssignment;
+import backtype.storm.scheduler.SupervisorDetails;
+import backtype.storm.scheduler.Topologies;
+import backtype.storm.scheduler.WorkerSlot;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+public class RAS_Nodes {
+
+ private Map<String, RAS_Node> nodeMap;
+
+ private static final Logger LOG =
LoggerFactory.getLogger(RAS_Nodes.class);
+
+ public RAS_Nodes(Cluster cluster, Topologies topologies) {
+ this.nodeMap = getAllNodesFrom(cluster, topologies);
+ }
+
+ public static Map<String, RAS_Node> getAllNodesFrom(Cluster cluster,
Topologies topologies) {
+ Map<String, RAS_Node> nodeIdToNode = new HashMap<String,
RAS_Node>();
+ for (SupervisorDetails sup : cluster.getSupervisors().values()) {
+ //Node ID and supervisor ID are the same.
+ String id = sup.getId();
+ boolean isAlive = !cluster.isBlackListed(id);
+ LOG.debug("Found a {} Node {} {}",
+ isAlive ? "living" : "dead", id, sup.getAllPorts());
+ LOG.debug("resources_mem: {}, resources_CPU: {}",
sup.getTotalMemory(), sup.getTotalCPU());
+ nodeIdToNode.put(sup.getId(), new RAS_Node(id,
sup.getAllPorts(), isAlive, sup, cluster, topologies));
+ }
+ for (Map.Entry<String, SchedulerAssignment> entry :
cluster.getAssignments().entrySet()) {
+ String topId = entry.getValue().getTopologyId();
+ for (WorkerSlot workerSlot : entry.getValue().getSlots()) {
+ String id = workerSlot.getNodeId();
+ RAS_Node node = nodeIdToNode.get(id);
+ if (node == null) {
+ LOG.info("Found an assigned slot on a dead supervisor
{} with executors {}",
+ workerSlot, RAS_Node.getExecutors(workerSlot,
cluster));
+ node = new RAS_Node(id, null, false, null, cluster,
topologies);
+ nodeIdToNode.put(id, node);
+ }
+ if (!node.isAlive()) {
+ //The supervisor on the node down so add an orphaned
slot to hold the unsupervised worker
--- End diff --
the node "is" down so
---
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.
---