You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by sr...@apache.org on 2016/05/27 21:06:53 UTC
[2/3] storm git commit: Fix script to return the proper return code
from the Java process
Fix script to return the proper return code from the Java process
Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/f0f2e2b9
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/f0f2e2b9
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/f0f2e2b9
Branch: refs/heads/1.x-branch
Commit: f0f2e2b96739bf67b5aa5aab114ae9699226ff9a
Parents: 94000ce
Author: Sivaguru Kannan <sc...@hortonworks.com>
Authored: Thu May 26 13:13:43 2016 -0700
Committer: Sivaguru Kannan <sc...@hortonworks.com>
Committed: Thu May 26 13:13:43 2016 -0700
----------------------------------------------------------------------
bin/storm.py | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/storm/blob/f0f2e2b9/bin/storm.py
----------------------------------------------------------------------
diff --git a/bin/storm.py b/bin/storm.py
index 69f219a..a990de7 100755
--- a/bin/storm.py
+++ b/bin/storm.py
@@ -209,8 +209,9 @@ def exec_storm_class(klass, jvmtype="-server", jvmopts=[], extrajars=[], args=[]
] + jvmopts + [klass] + list(args)
print("Running: " + " ".join(all_args))
sys.stdout.flush()
+ exit_code = 0
if fork:
- os.spawnvp(os.P_WAIT, JAVA_CMD, all_args)
+ exit_code = os.spawnvp(os.P_WAIT, JAVA_CMD, all_args)
elif is_windows():
# handling whitespaces in JAVA_CMD
try:
@@ -220,6 +221,7 @@ def exec_storm_class(klass, jvmtype="-server", jvmopts=[], extrajars=[], args=[]
sys.exit(e.returncode)
else:
os.execvp(JAVA_CMD, all_args)
+ return exit_code
def jar(jarfile, klass, *args):
"""Syntax: [storm jar topology-jar-path class ...]
@@ -234,14 +236,16 @@ def jar(jarfile, klass, *args):
if (transform_class != None and transform_class != "nil"):
tmpjar = os.path.join(tempfile.gettempdir(), uuid.uuid1().hex+".jar")
exec_storm_class("org.apache.storm.daemon.ClientJarTransformerRunner", args=[transform_class, jarfile, tmpjar], fork=True, daemon=False)
- exec_storm_class(
- klass,
- jvmtype="-client",
- extrajars=[tmpjar, USER_CONF_DIR, STORM_BIN_DIR],
- args=args,
- daemon=False,
- jvmopts=JAR_JVM_OPTS + ["-Dstorm.jar=" + tmpjar])
+ topology_runner_exit_code = exec_storm_class(
+ klass,
+ jvmtype="-client",
+ extrajars=[tmpjar, USER_CONF_DIR, STORM_BIN_DIR],
+ args=args,
+ daemon=False,
+ fork=True,
+ jvmopts=JAR_JVM_OPTS + ["-Dstorm.jar=" + tmpjar])
os.remove(tmpjar)
+ sys.exit(topology_runner_exit_code)
else:
exec_storm_class(
klass,