use of com.alibaba.jstorm.schedule.default_assign.ResourceWorkerSlot in project jstorm by alibaba.
the class SyncSupervisorEvent method getTopologyCodeLocations.
/**
* get master code dir for each topology
*
* @return Map: [topologyId, master-code-dir] from zookeeper
*/
public static Map<String, String> getTopologyCodeLocations(Map<String, Assignment> assignments, String supervisorId) throws Exception {
Map<String, String> rtn = new HashMap<>();
for (Entry<String, Assignment> entry : assignments.entrySet()) {
String topologyId = entry.getKey();
Assignment assignmentInfo = entry.getValue();
Set<ResourceWorkerSlot> workers = assignmentInfo.getWorkers();
for (ResourceWorkerSlot worker : workers) {
String node = worker.getNodeId();
if (supervisorId.equals(node)) {
rtn.put(topologyId, assignmentInfo.getMasterCodeDir());
break;
}
}
}
return rtn;
}
Aggregations