@VisibleForTesting LocallyCachedBlob getTopoJar(final String topologyId, String owner) { return topologyBlobs.computeIfAbsent(ConfigUtils.masterStormJarKey(topologyId), (tjk) -> { try { return new LocallyCachedTopologyBlob(topologyId, isLocalMode, conf, fsOps, LocallyCachedTopologyBlob.TopologyBlobType .TOPO_JAR, owner, metricsRegistry); } catch (IOException e) { throw new RuntimeException(e); } }); }
static List<String> getKeyListFromId(Map<String, Object> conf, String id) { List<String> ret = new ArrayList<>(3); ret.add(ConfigUtils.masterStormCodeKey(id)); ret.add(ConfigUtils.masterStormConfKey(id)); if (!ConfigUtils.isLocalMode(conf)) { ret.add(ConfigUtils.masterStormJarKey(id)); } return ret; }
private void setupStormCode(Map<String, Object> conf, String topoId, String tmpJarLocation, Map<String, Object> topoConf, StormTopology topology) throws Exception { Subject subject = getSubject(); IStormClusterState clusterState = stormClusterState; BlobStore store = blobStore; String jarKey = ConfigUtils.masterStormJarKey(topoId); if (tmpJarLocation != null) { //in local mode there is no jar try (FileInputStream fin = new FileInputStream(tmpJarLocation)) { store.createBlob(jarKey, fin, new SettableBlobMeta(BlobStoreAclHandler.DEFAULT), subject); } } topoCache.addTopoConf(topoId, subject, topoConf); topoCache.addTopology(topoId, subject, topology); }
@VisibleForTesting public void rmTopologyKeys(String topoId) { BlobStore store = blobStore; IStormClusterState state = stormClusterState; try { topoCache.deleteTopoConf(topoId, NIMBUS_SUBJECT); } catch (Exception e) { //Just go on and try to delete the others } try { topoCache.deleteTopology(topoId, NIMBUS_SUBJECT); } catch (Exception e) { //Just go on and try to delte the others } rmBlobKey(store, ConfigUtils.masterStormJarKey(topoId), state); }
int jarCount = minReplicationCount; if (!ConfigUtils.isLocalMode(topoConf)) { jarCount = getBlobReplicationCount(ConfigUtils.masterStormJarKey(topoId)); totalWaitTime++; if (!ConfigUtils.isLocalMode(topoConf)) { jarCount = getBlobReplicationCount(ConfigUtils.masterStormJarKey(topoId));
LOG.debug("Releasing slot for {} {}", topologyId, port); String topoJarKey = ConfigUtils.masterStormJarKey(topologyId); String topoCodeKey = ConfigUtils.masterStormCodeKey(topologyId); String topoConfKey = ConfigUtils.masterStormConfKey(topologyId);
protected void downloadBaseBlobs(File tmproot) throws Exception { String stormJarKey = ConfigUtils.masterStormJarKey(_topologyId); String stormCodeKey = ConfigUtils.masterStormCodeKey(_topologyId); String stormConfKey = ConfigUtils.masterStormConfKey(_topologyId); String jarPath = ConfigUtils.supervisorStormJarPath(tmproot.getAbsolutePath()); String codePath = ConfigUtils.supervisorStormCodePath(tmproot.getAbsolutePath()); String confPath = ConfigUtils.supervisorStormConfPath(tmproot.getAbsolutePath()); _fsOps.forceMkdir(tmproot); _fsOps.restrictDirectoryPermissions(tmproot); ClientBlobStore blobStore = Utils.getClientBlobStoreForSupervisor(_conf); try { Utils.downloadResourcesAsSupervisor(stormJarKey, jarPath, blobStore); Utils.downloadResourcesAsSupervisor(stormCodeKey, codePath, blobStore); Utils.downloadResourcesAsSupervisor(stormConfKey, confPath, blobStore); } finally { blobStore.shutdown(); } Utils.extractDirFromJar(jarPath, ConfigUtils.RESOURCES_SUBDIR, tmproot); }