From 625f8a27a3afccb6cc770067336a39b1a1c58741 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=AF=E5=BC=80=E9=9C=9E00024505?= Date: Sat, 4 Feb 2017 16:04:28 +0800 Subject: [PATCH 1/3] fix : allow to submit more topos --- .../java/backtype/storm/StormSubmitter.java | 63 ++++++++++--------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/jstorm-core/src/main/java/backtype/storm/StormSubmitter.java b/jstorm-core/src/main/java/backtype/storm/StormSubmitter.java index b50997f9e..f6ba8d9f1 100644 --- a/jstorm-core/src/main/java/backtype/storm/StormSubmitter.java +++ b/jstorm-core/src/main/java/backtype/storm/StormSubmitter.java @@ -200,45 +200,46 @@ 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 lib = (List) conf.get(GenericOptionsParser.TOPOLOGY_LIB_NAME); - Map libPath = (Map) 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"); - } + String submittedJar = null; +// 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 lib = (List) conf.get(GenericOptionsParser.TOPOLOGY_LIB_NAME); + Map libPath = (Map) 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) { + submittedJar = 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) { From 685c54a822ad3cfefd6f57d22d7443c8105b9477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=AF=E5=BC=80=E9=9C=9E00024505?= Date: Sat, 4 Feb 2017 16:12:29 +0800 Subject: [PATCH 2/3] fix : allow to submit more topos --- jstorm-core/src/main/java/backtype/storm/StormSubmitter.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/jstorm-core/src/main/java/backtype/storm/StormSubmitter.java b/jstorm-core/src/main/java/backtype/storm/StormSubmitter.java index f6ba8d9f1..5a920d443 100644 --- a/jstorm-core/src/main/java/backtype/storm/StormSubmitter.java +++ b/jstorm-core/src/main/java/backtype/storm/StormSubmitter.java @@ -204,7 +204,6 @@ public static boolean topologyNameExists(NimbusClient client, Map conf, String n private static String path = null; private static void submitJar(NimbusClient client, Map conf) { - String submittedJar = null; // if (submittedJar == null) { try { LOG.info("Jar not uploaded to master yet. Submitting jar..."); @@ -229,7 +228,7 @@ private static void submitJar(NimbusClient client, Map conf) { } if (localJar != null) { - submittedJar = submitJar(conf, localJar, uploadLocation, client); + submitJar(conf, localJar, uploadLocation, client); } else { // no client jar, but with lib jar client.getClient().finishFileUpload(uploadLocation); From 65329cfed450bc76348b80ac990af4bc2456f089 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=AF=E5=BC=80=E9=9C=9E00024505?= Date: Sat, 4 Feb 2017 16:17:57 +0800 Subject: [PATCH 3/3] modify command :/bin/bash-->/bin/sh/ --- .../src/main/java/com/alibaba/jstorm/utils/SystemOperation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jstorm-core/src/main/java/com/alibaba/jstorm/utils/SystemOperation.java b/jstorm-core/src/main/java/com/alibaba/jstorm/utils/SystemOperation.java index 8c2158190..178076c37 100644 --- a/jstorm-core/src/main/java/com/alibaba/jstorm/utils/SystemOperation.java +++ b/jstorm-core/src/main/java/com/alibaba/jstorm/utils/SystemOperation.java @@ -49,7 +49,7 @@ public static void umount(String name) throws IOException { public static String exec(String cmd) throws IOException { List commands = new ArrayList(); - commands.add("/bin/bash"); + commands.add("/bin/sh"); commands.add("-c"); commands.add(cmd);