You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by bo...@apache.org on 2018/10/05 15:20:29 UTC
[1/2] storm git commit: Fixes & ports shell submission to Java
Repository: storm
Updated Branches:
refs/heads/master b6b2b7d14 -> e82052339
Fixes & ports shell submission to Java
Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/d1b6f763
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/d1b6f763
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/d1b6f763
Branch: refs/heads/master
Commit: d1b6f76381ec8d8aca4d28fdec5e82711ed06176
Parents: ad63cc2
Author: Derek Dagit <de...@oath.com>
Authored: Wed Oct 3 11:06:31 2018 -0500
Committer: Derek Dagit <de...@oath.com>
Committed: Wed Oct 3 11:06:31 2018 -0500
----------------------------------------------------------------------
bin/storm.py | 2 +-
.../apache/storm/command/shell_submission.clj | 33 --------------
.../apache/storm/command/ShellSubmission.java | 46 ++++++++++++++++++++
3 files changed, 47 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/storm/blob/d1b6f763/bin/storm.py
----------------------------------------------------------------------
diff --git a/bin/storm.py b/bin/storm.py
index 1183f9d..2f2de6e 100755
--- a/bin/storm.py
+++ b/bin/storm.py
@@ -687,7 +687,7 @@ def shell(resourcesdir, command, *args):
runnerargs = [tmpjarpath, command]
runnerargs.extend(args)
exec_storm_class(
- "org.apache.storm.command.shell_submission",
+ "org.apache.storm.command.ShellSubmission",
args=runnerargs,
jvmtype="-client",
extrajars=[USER_CONF_DIR],
http://git-wip-us.apache.org/repos/asf/storm/blob/d1b6f763/storm-core/src/clj/org/apache/storm/command/shell_submission.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/org/apache/storm/command/shell_submission.clj b/storm-core/src/clj/org/apache/storm/command/shell_submission.clj
deleted file mode 100644
index 6bd5570..0000000
--- a/storm-core/src/clj/org/apache/storm/command/shell_submission.clj
+++ /dev/null
@@ -1,33 +0,0 @@
-;; Licensed to the Apache Software Foundation (ASF) under one
-;; or more contributor license agreements. See the NOTICE file
-;; distributed with this work for additional information
-;; regarding copyright ownership. The ASF licenses this file
-;; to you under the Apache License, Version 2.0 (the
-;; "License"); you may not use this file except in compliance
-;; with the License. You may obtain a copy of the License at
-;;
-;; http://www.apache.org/licenses/LICENSE-2.0
-;;
-;; Unless required by applicable law or agreed to in writing, software
-;; distributed under the License is distributed on an "AS IS" BASIS,
-;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;; See the License for the specific language governing permissions and
-;; limitations under the License.
-(ns org.apache.storm.command.shell-submission
- (:import [org.apache.storm Config StormSubmitter]
- [org.apache.storm.utils ServerUtils])
- (:use [org.apache.storm util config log])
- (:import [org.apache.storm.utils ConfigUtils NimbusClient])
- (:gen-class))
-
-
-(defn -main [^String tmpjarpath & args]
- (let [conf (clojurify-structure (ConfigUtils/readStormConfig))]
- (with-open [client (NimbusClient/getConfiguredClient conf)]
- (let [c (.getClient client)
- ns (.getLeader c)
- host (.get_host ns)
- port (.get_port ns)
- jarpath (StormSubmitter/submitJar conf tmpjarpath)
- args (concat args [host port jarpath])]
- (ServerUtils/execCommand args)))))
http://git-wip-us.apache.org/repos/asf/storm/blob/d1b6f763/storm-core/src/jvm/org/apache/storm/command/ShellSubmission.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/org/apache/storm/command/ShellSubmission.java b/storm-core/src/jvm/org/apache/storm/command/ShellSubmission.java
new file mode 100644
index 0000000..895a266
--- /dev/null
+++ b/storm-core/src/jvm/org/apache/storm/command/ShellSubmission.java
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
+ * and limitations under the License.
+ */
+
+package org.apache.storm.command;
+
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.storm.StormSubmitter;
+import org.apache.storm.generated.NimbusSummary;
+import org.apache.storm.utils.ConfigUtils;
+import org.apache.storm.utils.NimbusClient;
+import org.apache.storm.utils.ServerUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Arrays;
+import java.util.Map;
+
+public class ShellSubmission {
+ private static final Logger LOG = LoggerFactory.getLogger(ShellSubmission.class);
+
+ public static void main(String[] args) throws Exception {
+ if (args.length <= 1) {
+ LOG.error("Arguments should be of the form: <path_to_jar> [argument...]");
+ System.exit(-1);
+ }
+ Map<String,Object> conf = ConfigUtils.readStormConfig();
+ try (NimbusClient client = NimbusClient.getConfiguredClient(conf)) {
+ NimbusSummary ns = client.getClient().getLeader();
+ String host = ns.get_host();
+ int port = ns.get_port();
+ String jarPath = StormSubmitter.submitJar(conf, args[0]);
+ String[] newArgs = (String[]) ArrayUtils.addAll(Arrays.copyOfRange(args, 1, args.length),
+ new String[]{host, String.valueOf(port), jarPath});
+ ServerUtils.execCommand(newArgs);
+ }
+ }
+}
\ No newline at end of file
[2/2] storm git commit: Merge branch 'port-shellsubmission-to-java'
of https://github.com/d2r/storm into STORM-1318
Posted by bo...@apache.org.
Merge branch 'port-shellsubmission-to-java' of https://github.com/d2r/storm into STORM-1318
STORM-1318: Fixes & ports shell submission to Java
This closes #2860
Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/e8205233
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/e8205233
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/e8205233
Branch: refs/heads/master
Commit: e82052339bd0567d132017ace4e303be3056c82f
Parents: b6b2b7d d1b6f76
Author: Robert Evans <ev...@yahoo-inc.com>
Authored: Fri Oct 5 09:30:14 2018 -0500
Committer: Robert Evans <ev...@yahoo-inc.com>
Committed: Fri Oct 5 09:30:14 2018 -0500
----------------------------------------------------------------------
bin/storm.py | 2 +-
.../apache/storm/command/shell_submission.clj | 33 --------------
.../apache/storm/command/ShellSubmission.java | 46 ++++++++++++++++++++
3 files changed, 47 insertions(+), 34 deletions(-)
----------------------------------------------------------------------