Skip to content
This repository was archived by the owner on Jun 16, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 31 additions & 31 deletions jstorm-core/src/main/java/backtype/storm/StormSubmitter.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,45 +200,45 @@ public static boolean topologyNameExists(NimbusClient client, Map conf, String n
}
}

private static String submittedJar = null;
//private static String submittedJar = null;
private static String path = null;

private static void submitJar(NimbusClient client, Map conf) {
if (submittedJar == null) {
try {
LOG.info("Jar not uploaded to master yet. Submitting jar...");
String localJar = System.getProperty("storm.jar");
path = client.getClient().beginFileUpload();
String[] pathCache = path.split("/");
String uploadLocation = path + "/stormjar-" + pathCache[pathCache.length - 1] + ".jar";
List<String> lib = (List<String>) conf.get(GenericOptionsParser.TOPOLOGY_LIB_NAME);
Map<String, String> libPath = (Map<String, String>) conf.get(GenericOptionsParser.TOPOLOGY_LIB_PATH);
if (lib != null && lib.size() != 0) {
for (String libName : lib) {
String jarPath = path + "/lib/" + libName;
client.getClient().beginLibUpload(jarPath);
submitJar(conf, libPath.get(libName), jarPath, client);
}

} else {
if (localJar == null) {
// no lib, no client jar
throw new RuntimeException("No client app jar, please upload it");
}
// if (submittedJar == null) {
try {
LOG.info("Jar not uploaded to master yet. Submitting jar...");
String localJar = System.getProperty("storm.jar");
path = client.getClient().beginFileUpload();
String[] pathCache = path.split("/");
String uploadLocation = path + "/stormjar-" + pathCache[pathCache.length - 1] + ".jar";
List<String> lib = (List<String>) conf.get(GenericOptionsParser.TOPOLOGY_LIB_NAME);
Map<String, String> libPath = (Map<String, String>) conf.get(GenericOptionsParser.TOPOLOGY_LIB_PATH);
if (lib != null && lib.size() != 0) {
for (String libName : lib) {
String jarPath = path + "/lib/" + libName;
client.getClient().beginLibUpload(jarPath);
submitJar(conf, libPath.get(libName), jarPath, client);
}

if (localJar != null) {
submittedJar = submitJar(conf, localJar, uploadLocation, client);
} else {
// no client jar, but with lib jar
client.getClient().finishFileUpload(uploadLocation);
} else {
if (localJar == null) {
// no lib, no client jar
throw new RuntimeException("No client app jar, please upload it");
}
} catch (Exception e) {
throw new RuntimeException(e);
}
} else {
LOG.info("Jar already uploaded to master. Not submitting jar.");

if (localJar != null) {
submitJar(conf, localJar, uploadLocation, client);
} else {
// no client jar, but with lib jar
client.getClient().finishFileUpload(uploadLocation);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
// } else {
// LOG.info("Jar already uploaded to master. Not submitting jar.");
// }
}

public static String submitJar(Map conf, String localJar, String uploadLocation, NimbusClient client) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static void umount(String name) throws IOException {

public static String exec(String cmd) throws IOException {
List<String> commands = new ArrayList<String>();
commands.add("/bin/bash");
commands.add("/bin/sh");
commands.add("-c");
commands.add(cmd);

Expand Down