Search in sources :

Example 21 with TopologyInfo

use of org.apache.storm.generated.TopologyInfo in project storm by apache.

the class UIHelpers method putTopologyActivate.

/**
 * putTopologyActivate.
 * @param client client
 * @param id id
 * @return putTopologyActivate
 * @throws TException TException
 */
public static Map<String, Object> putTopologyActivate(Nimbus.Iface client, String id) throws TException {
    GetInfoOptions getInfoOptions = new GetInfoOptions();
    getInfoOptions.set_num_err_choice(NumErrorsChoice.NONE);
    TopologyInfo topologyInfo = client.getTopologyInfoWithOpts(id, getInfoOptions);
    client.activate(topologyInfo.get_name());
    return getTopologyOpResponse(id, "activate");
}
Also used : GetInfoOptions(org.apache.storm.generated.GetInfoOptions) TopologyInfo(org.apache.storm.generated.TopologyInfo)

Example 22 with TopologyInfo

use of org.apache.storm.generated.TopologyInfo in project storm by apache.

the class UIHelpers method putTopologyDeactivate.

/**
 * putTopologyDeactivate.
 * @param client client
 * @param id id
 * @return putTopologyDeactivate
 * @throws TException TException
 */
public static Map<String, Object> putTopologyDeactivate(Nimbus.Iface client, String id) throws TException {
    GetInfoOptions getInfoOptions = new GetInfoOptions();
    getInfoOptions.set_num_err_choice(NumErrorsChoice.NONE);
    TopologyInfo topologyInfo = client.getTopologyInfoWithOpts(id, getInfoOptions);
    client.deactivate(topologyInfo.get_name());
    return getTopologyOpResponse(id, "deactivate");
}
Also used : GetInfoOptions(org.apache.storm.generated.GetInfoOptions) TopologyInfo(org.apache.storm.generated.TopologyInfo)

Example 23 with TopologyInfo

use of org.apache.storm.generated.TopologyInfo in project storm by apache.

the class StormSubmitter method invokeSubmitterHook.

/**
 * Invoke submitter hook.
 * @throws SubmitterHookException This is thrown when any Exception occurs during initialization or invocation of registered {@link
 *     ISubmitterHook}
 */
private static void invokeSubmitterHook(String name, String asUser, Map<String, Object> topoConf, StormTopology topology) {
    String submissionNotifierClassName = null;
    try {
        if (topoConf.containsKey(Config.STORM_TOPOLOGY_SUBMISSION_NOTIFIER_PLUGIN)) {
            submissionNotifierClassName = topoConf.get(Config.STORM_TOPOLOGY_SUBMISSION_NOTIFIER_PLUGIN).toString();
            LOG.info("Initializing the registered ISubmitterHook [{}]", submissionNotifierClassName);
            if (submissionNotifierClassName == null || submissionNotifierClassName.isEmpty()) {
                throw new IllegalArgumentException(Config.STORM_TOPOLOGY_SUBMISSION_NOTIFIER_PLUGIN + " property must be a non empty string.");
            }
            ISubmitterHook submitterHook = (ISubmitterHook) Class.forName(submissionNotifierClassName).newInstance();
            TopologyInfo topologyInfo = Utils.getTopologyInfo(name, asUser, topoConf);
            LOG.info("Invoking the registered ISubmitterHook [{}]", submissionNotifierClassName);
            submitterHook.notify(topologyInfo, topoConf, topology);
        }
    } catch (Exception e) {
        LOG.warn("Error occurred in invoking submitter hook:[{}] ", submissionNotifierClassName, e);
        throw new SubmitterHookException(e);
    }
}
Also used : TopologyInfo(org.apache.storm.generated.TopologyInfo) SubmitterHookException(org.apache.storm.hooks.SubmitterHookException) AlreadyAliveException(org.apache.storm.generated.AlreadyAliveException) TException(org.apache.storm.thrift.TException) AuthorizationException(org.apache.storm.generated.AuthorizationException) NotAliveException(org.apache.storm.generated.NotAliveException) WrappedInvalidTopologyException(org.apache.storm.utils.WrappedInvalidTopologyException) InvalidTopologyException(org.apache.storm.generated.InvalidTopologyException) SubmitterHookException(org.apache.storm.hooks.SubmitterHookException)

Aggregations

TopologyInfo (org.apache.storm.generated.TopologyInfo)23 ExecutorSummary (org.apache.storm.generated.ExecutorSummary)12 GetInfoOptions (org.apache.storm.generated.GetInfoOptions)9 Map (java.util.Map)8 HashMap (java.util.HashMap)7 List (java.util.List)7 ArrayList (java.util.ArrayList)6 TopologySummary (org.apache.storm.generated.TopologySummary)6 ExecutorStats (org.apache.storm.generated.ExecutorStats)5 SpoutStats (org.apache.storm.generated.SpoutStats)5 ImmutableMap (com.google.common.collect.ImmutableMap)4 HashSet (java.util.HashSet)4 AlreadyAliveException (org.apache.storm.generated.AlreadyAliveException)4 AuthorizationException (org.apache.storm.generated.AuthorizationException)4 InvalidTopologyException (org.apache.storm.generated.InvalidTopologyException)4 StormTopology (org.apache.storm.generated.StormTopology)4 File (java.io.File)3 IOException (java.io.IOException)3 Collectors (java.util.stream.Collectors)3 Config (org.apache.storm.Config)3