/** * Submit jar file * * @param conf the topology-specific configuration. See {@link Config}. * @param localJar file path of the jar file to submit * @param listener progress listener to track the jar file upload * @return the remote location of the submitted jar */ public static String submitJar(Map<String, Object> conf, String localJar, ProgressListener listener) { return submitJarAs(conf, localJar, listener, (String) null); }
public static String submitJarAs(Map<String, Object> conf, String localJar, ProgressListener listener, String asUser) { if (localJar == null) { throw new RuntimeException( "Must submit topologies using the 'storm' client script so that StormSubmitter knows which jar to upload."); } try (NimbusClient client = NimbusClient.getConfiguredClientAs(conf, asUser)) { return submitJarAs(conf, localJar, listener, client); } }
private static void submitTopologyInDistributeMode(String name, StormTopology topology, SubmitOptions opts, ProgressListener progressListener, String asUser, Map<String, Object> conf, String serConf, NimbusClient client) throws TException { try { String jar = submitJarAs(conf, System.getProperty("storm.jar"), progressListener, client); LOG.info("Submitting topology {} in distributed mode with conf {}", name, serConf); Utils.addVersions(topology); if (opts != null) { client.getClient().submitTopologyWithOpts(name, jar, serConf, topology, opts); } else { // this is for backwards compatibility client.getClient().submitTopology(name, jar, serConf, topology); } LOG.info("Finished submitting topology: {}", name); } catch (InvalidTopologyException e) { LOG.error("Topology submission exception: {}", e.get_msg()); throw e; } catch (AlreadyAliveException e) { LOG.error("Topology already alive exception", e); throw e; } }
/** * Submit jar file * @param conf the topology-specific configuration. See {@link Config}. * @param localJar file path of the jar file to submit * @param listener progress listener to track the jar file upload * @return the remote location of the submitted jar */ public static String submitJar(Map conf, String localJar, ProgressListener listener) { return submitJarAs(conf,localJar, listener, (String)null); }
public static String submitJarAs(Map conf, String localJar, ProgressListener listener, String asUser) { if (localJar == null) { throw new RuntimeException("Must submit topologies using the 'storm' client script so that StormSubmitter knows which jar to upload."); } try (NimbusClient client = NimbusClient.getConfiguredClientAs(conf, asUser)) { return submitJarAs(conf, localJar, listener, client); } }
private static void submitTopologyInDistributeMode(String name, StormTopology topology, SubmitOptions opts, ProgressListener progressListener, String asUser, Map conf, String serConf, NimbusClient client) throws TException { try { String jar = submitJarAs(conf, System.getProperty("storm.jar"), progressListener, client); LOG.info("Submitting topology {} in distributed mode with conf {}", name, serConf); Utils.addVersions(topology); if (opts != null) { client.getClient().submitTopologyWithOpts(name, jar, serConf, topology, opts); } else { // this is for backwards compatibility client.getClient().submitTopology(name, jar, serConf, topology); } LOG.info("Finished submitting topology: {}", name); } catch (InvalidTopologyException e) { LOG.warn("Topology submission exception: {}", e.get_msg()); throw e; } catch (AlreadyAliveException e) { LOG.warn("Topology already alive exception", e); throw e; } }