protected Map<String, Object> readTopoConf() throws IOException { assert (_topologyId != null); return ConfigUtils.readSupervisorStormConf(_conf, _topologyId); }
@Override public void sendSupervisorWorkerHeartbeat(SupervisorWorkerHeartbeat heartbeat) throws AuthorizationException, NotAliveException, TException { // do nothing except validate heartbeat for now. String id = heartbeat.get_storm_id(); Map<String, Object> topoConf = null; try { topoConf = ConfigUtils.readSupervisorStormConf(conf, id); } catch (IOException e) { LOG.warn("Topology config is not localized yet..."); throw new WrappedNotAliveException(id + " does not appear to be alive, you should probably exit"); } checkAuthorization(id, topoConf, "sendSupervisorWorkerHeartbeat"); } });
private List<LocalResource> getLocalResources(PortAndAssignment pna) throws IOException { String topologyId = pna.getToplogyId(); Map<String, Object> topoConf = ConfigUtils.readSupervisorStormConf(conf, topologyId); @SuppressWarnings("unchecked") Map<String, Map<String, Object>> blobstoreMap = (Map<String, Map<String, Object>>) topoConf.get(Config.TOPOLOGY_BLOBSTORE_MAP); List<LocalResource> ret = new ArrayList<>(); if (blobstoreMap != null) { List<LocalResource> tmp = SupervisorUtils.blobstoreMapToLocalresources(blobstoreMap); if (tmp != null) { ret.addAll(tmp); } } StormTopology stormCode = ConfigUtils.readSupervisorTopology(conf, topologyId, fsOps); List<String> dependencies = new ArrayList<>(); if (stormCode.is_set_dependency_jars()) { dependencies.addAll(stormCode.get_dependency_jars()); } if (stormCode.is_set_dependency_artifacts()) { dependencies.addAll(stormCode.get_dependency_artifacts()); } for (String dependency : dependencies) { ret.add(new LocalResource(dependency, false, true)); } return ret; }
@Override public Assignment getLocalAssignmentForStorm(String id) throws NotAliveException, AuthorizationException, TException { Map<String, Object> topoConf = null; try { topoConf = ConfigUtils.readSupervisorStormConf(conf, id); } catch (IOException e) { LOG.warn("Topology config is not localized yet..."); } checkAuthorization(id, topoConf, "getLocalAssignmentForStorm"); Assignment assignment = getStormClusterState().assignmentInfo(id, null); if (null == assignment) { throw new WrappedNotAliveException("No local assignment assigned for storm: " + id + " for node: " + getHostName()); } return assignment; }
String topoOwner = pna.getOwner(); String stormroot = ConfigUtils.supervisorStormDistRoot(conf, topologyId); Map<String, Object> topoConf = ConfigUtils.readSupervisorStormConf(conf, topologyId);
ConfigUtils.overrideLoginConfigWithSystemProperty(ConfigUtils.readSupervisorStormConf(conf, topologyId)); ClusterStateContext csContext = new ClusterStateContext(DaemonType.WORKER, topologyConf); IStateStorage stateStorage = ClusterUtils.mkStateStorage(conf, topologyConf, csContext);
protected Map<String, Object> readTopoConf() throws IOException { assert(_topologyId != null); return ConfigUtils.readSupervisorStormConf(_conf, _topologyId); }
/** * For each of the downloaded topologies, adds references to the blobs that the topologies are using. This is used to reconstruct the cache on restart. * * @param localizer * @param stormId * @param conf */ static void addBlobReferences(Localizer localizer, String stormId, Map<String, Object> conf, String user) throws IOException { Map<String, Object> stormConf = ConfigUtils.readSupervisorStormConf(conf, stormId); Map<String, Map<String, Object>> blobstoreMap = (Map<String, Map<String, Object>>) stormConf.get(Config.TOPOLOGY_BLOBSTORE_MAP); String topoName = (String) stormConf.get(Config.TOPOLOGY_NAME); List<LocalResource> localresources = SupervisorUtils.blobstoreMapToLocalresources(blobstoreMap); if (blobstoreMap != null) { localizer.addReferences(localresources, user, topoName); } }
/** * Update each blob listed in the topology configuration if the latest version of the blob has not been downloaded. * * @param conf * @param stormId * @param localizer * @throws IOException */ private void updateBlobsForTopology(Map<String, Object> conf, String stormId, Localizer localizer, String user) throws IOException { Map<String, Object> topoConf = ConfigUtils.readSupervisorStormConf(conf, stormId); Map<String, Map<String, Object>> blobstoreMap = (Map<String, Map<String, Object>>) topoConf.get(Config.TOPOLOGY_BLOBSTORE_MAP); List<LocalResource> localresources = SupervisorUtils.blobstoreMapToLocalresources(blobstoreMap); try { localizer.updateBlobs(localresources, user); } catch (AuthorizationException authExp) { LOG.error("AuthorizationException error", authExp); } catch (KeyNotFoundException knf) { LOG.error("KeyNotFoundException error", knf); } } }
LOG.info("Released blob reference {} {} Cleaning up BLOB references...", topologyId, port); _blobPending.remove(topologyId); Map<String, Object> topoConf = ConfigUtils.readSupervisorStormConf(_conf, topologyId); @SuppressWarnings("unchecked") Map<String, Map<String, Object>> blobstoreMap = (Map<String, Map<String, Object>>) topoConf.get(Config.TOPOLOGY_BLOBSTORE_MAP);
try { String stormroot = ConfigUtils.supervisorStormDistRoot(_conf, _topologyId); Map<String, Object> topoConf = ConfigUtils.readSupervisorStormConf(_conf, _topologyId);