use of org.apache.storm.cluster.IStormClusterState in project storm by apache.
the class Nimbus method rmDependencyJarsInTopology.
@VisibleForTesting
public void rmDependencyJarsInTopology(String topoId) {
try {
BlobStore store = blobStore;
IStormClusterState state = stormClusterState;
StormTopology topo = readStormTopologyAsNimbus(topoId, store);
List<String> dependencyJars = topo.get_dependency_jars();
LOG.info("Removing dependency jars from blobs - {}", dependencyJars);
if (dependencyJars != null && !dependencyJars.isEmpty()) {
for (String key : dependencyJars) {
rmBlobKey(store, key, state);
}
}
} catch (Exception e) {
//Yes eat the exception
LOG.info("Exception {}", e);
}
}
use of org.apache.storm.cluster.IStormClusterState in project storm by apache.
the class Nimbus method renewCredentials.
private void renewCredentials() throws Exception {
if (!isLeader()) {
LOG.info("not a leader, skipping credential renewal.");
return;
}
IStormClusterState state = stormClusterState;
BlobStore store = blobStore;
Collection<ICredentialsRenewer> renewers = credRenewers;
Object lock = credUpdateLock;
List<String> assignedIds = state.activeStorms();
if (assignedIds != null) {
for (String id : assignedIds) {
Map<String, Object> topoConf = Collections.unmodifiableMap(tryReadTopoConf(id, store));
synchronized (lock) {
Credentials origCreds = state.credentials(id, null);
if (origCreds != null) {
Map<String, String> orig = origCreds.get_creds();
Map<String, String> newCreds = new HashMap<>(orig);
for (ICredentialsRenewer renewer : renewers) {
LOG.info("Renewing Creds For {} with {}", id, renewer);
renewer.renew(newCreds, topoConf);
}
if (!newCreds.equals(origCreds)) {
state.setCredentials(id, new Credentials(newCreds), topoConf);
}
}
}
}
}
}
use of org.apache.storm.cluster.IStormClusterState in project storm by apache.
the class Nimbus method updateHeartbeats.
private void updateHeartbeats(String topoId, Set<List<Integer>> allExecutors, Assignment existingAssignment) {
LOG.debug("Updating heartbeats for {} {}", topoId, allExecutors);
IStormClusterState state = stormClusterState;
Map<List<Integer>, Map<String, Object>> executorBeats = StatsUtil.convertExecutorBeats(state.executorBeats(topoId, existingAssignment.get_executor_node_port()));
Map<List<Integer>, Map<String, Object>> cache = StatsUtil.updateHeartbeatCache(heartbeatsCache.get().get(topoId), executorBeats, allExecutors, Utils.getInt(conf.get(Config.NIMBUS_TASK_TIMEOUT_SECS)));
heartbeatsCache.getAndUpdate(new Assoc<>(topoId, cache));
}
Aggregations