Skip to content
This repository has been archived by the owner on Jun 16, 2023. It is now read-only.

run jstorm without cygwin #137

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
17 changes: 13 additions & 4 deletions bin/jstorm.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,15 @@ def cygpath(x):
normclasspath = cygpath
else:
normclasspath = identity

if sys.platform == "win32":
jarsp = ";"
else:
jarsp= ":"
#pdb.set_trace()
CLIENT_CONF_FILE = ""
JSTORM_DIR = "/".join(os.path.realpath( __file__ ).split("/")[:-2])
if JSTORM_DIR == "":
JSTORM_DIR = "."
JSTORM_CONF_DIR = os.getenv("JSTORM_CONF_DIR", JSTORM_DIR + "/conf" )
LOGBACK_CONF = JSTORM_CONF_DIR + "/jstorm.logback.xml"
CONFIG_OPTS = []
Expand All @@ -50,7 +56,10 @@ def cygpath(x):


def check_java():
check_java_cmd = 'which java'
if sys.platform == "win32":
check_java_cmd = 'for %i in (java.exe) do @echo. %~$PATH:i'
else:
check_java_cmd = 'which java'
ret = os.system(check_java_cmd)
if ret != 0:
print("Failed to find java, please add java to PATH")
Expand Down Expand Up @@ -105,7 +114,7 @@ def get_classpath(extrajars):
ret.extend(get_jars_full(JSTORM_DIR))
ret.extend(get_jars_full(JSTORM_DIR + "/lib"))
ret.extend(INCLUDE_JARS)
return normclasspath(":".join(ret))
return normclasspath(jarsp.join(ret))


def confvalue(name, extrapaths):
Expand Down Expand Up @@ -162,7 +171,7 @@ def exec_storm_class(klass, jvmtype="-server", childopts="", extrajars=[], args=
print args_str
if "NimbusServer" in klass:
# fix cmd > 4096, use dir in cp, only for nimbus server
command = "java " + jvmtype + " -Djstorm.home=" + JSTORM_DIR + " " + get_config_opts() + " -Djava.library.path=" + nativepath + " " + childopts + " -cp " + get_classpath(extrajars) + ":" + JSTORM_DIR + "/lib/ext/* " + klass + " " + args_str
command = "java " + jvmtype + " -Djstorm.home=" + JSTORM_DIR + " " + get_config_opts() + " -Djava.library.path=" + nativepath + " " + childopts + " -cp " + get_classpath(extrajars) + jarsp + JSTORM_DIR + "/lib/ext/* " + klass + " " + args_str
else:
command = "java " + jvmtype + " -Djstorm.home=" + JSTORM_DIR + " " + get_config_opts() + " -Djava.library.path=" + nativepath + " " + childopts + " -cp " + get_classpath(extrajars) + " " + klass + " " + args_str
print "Running: " + command
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import com.alibaba.jstorm.daemon.worker.WorkerReportError;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.SystemUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -188,8 +189,10 @@ public void run() {
createPid(conf);

supervisorManager = mkSupervisor(conf, null);

JStormUtils.redirectOutput("/dev/null");

if(SystemUtils.IS_OS_LINUX){
JStormUtils.redirectOutput("/dev/null");
}

initShutdownHook(supervisorManager);

Expand Down