You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by st...@apache.org on 2014/06/25 20:23:22 UTC
[01/14] git commit: SLIDER-153: stub .py command
Repository: incubator-slider
Updated Branches:
refs/heads/develop 93bd8ce6f -> 9619c3356
SLIDER-153: stub .py command
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/19d313d7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/19d313d7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/19d313d7
Branch: refs/heads/develop
Commit: 19d313d7fb879ff8aff24494800870a704100df1
Parents: 5023eb5
Author: Steve Loughran <st...@apache.org>
Authored: Fri Jun 20 18:07:54 2014 -0700
Committer: Steve Loughran <st...@apache.org>
Committed: Fri Jun 20 18:07:54 2014 -0700
----------------------------------------------------------------------
slider-assembly/src/main/scripts/slider.py | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/19d313d7/slider-assembly/src/main/scripts/slider.py
----------------------------------------------------------------------
diff --git a/slider-assembly/src/main/scripts/slider.py b/slider-assembly/src/main/scripts/slider.py
new file mode 100644
index 0000000..f154210
--- /dev/null
+++ b/slider-assembly/src/main/scripts/slider.py
@@ -0,0 +1,22 @@
+# !/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# 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.
+
+# Slider main method
+
+if __name__ == '__main__':
+ print "slider python script"
\ No newline at end of file
[03/14] git commit: SLIDER-153 stub main()
Posted by st...@apache.org.
SLIDER-153 stub main()
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/d6131ca4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/d6131ca4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/d6131ca4
Branch: refs/heads/develop
Commit: d6131ca426bee6e8aa9819a377bb82345fc97b56
Parents: e519fbc
Author: Steve Loughran <st...@apache.org>
Authored: Mon Jun 23 13:41:18 2014 -0700
Committer: Steve Loughran <st...@apache.org>
Committed: Mon Jun 23 13:41:18 2014 -0700
----------------------------------------------------------------------
slider-assembly/src/main/scripts/slider.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/d6131ca4/slider-assembly/src/main/scripts/slider.py
----------------------------------------------------------------------
diff --git a/slider-assembly/src/main/scripts/slider.py b/slider-assembly/src/main/scripts/slider.py
index f154210..d5891ed 100644
--- a/slider-assembly/src/main/scripts/slider.py
+++ b/slider-assembly/src/main/scripts/slider.py
@@ -15,8 +15,14 @@
# 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.
+import sys
+import subprocess
# Slider main method
-
+def main():
+
+
if __name__ == '__main__':
- print "slider python script"
\ No newline at end of file
+ print "slider python script"
+ rv = main()
+ sys.exit(rv)
[11/14] git commit: SLIDER-153 revert rename -> slider.py for python
Posted by st...@apache.org.
SLIDER-153 revert rename -> slider.py for python
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/1c5f303f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/1c5f303f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/1c5f303f
Branch: refs/heads/develop
Commit: 1c5f303f31693b89c1d767043655b16922ae0b57
Parents: 6f05995
Author: Steve Loughran <st...@apache.org>
Authored: Wed Jun 25 11:21:29 2014 -0700
Committer: Steve Loughran <st...@apache.org>
Committed: Wed Jun 25 11:21:29 2014 -0700
----------------------------------------------------------------------
slider-assembly/src/main/scripts/slider | 169 ------------------------
slider-assembly/src/main/scripts/slider.py | 169 ++++++++++++++++++++++++
2 files changed, 169 insertions(+), 169 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/1c5f303f/slider-assembly/src/main/scripts/slider
----------------------------------------------------------------------
diff --git a/slider-assembly/src/main/scripts/slider b/slider-assembly/src/main/scripts/slider
deleted file mode 100644
index d48eca6..0000000
--- a/slider-assembly/src/main/scripts/slider
+++ /dev/null
@@ -1,169 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# 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.
-import sys
-import os
-import subprocess
-
-CONF = "conf"
-
-LIB = "lib"
-
-SLIDER_CONF_DIR = "SLIDER_CONF_DIR"
-SLIDER_JVM_OPTS = "SLIDER_JVM_OPTS"
-SLIDER_CLASSPATH_EXTRA = "SLIDER_CLASSPATH_EXTRA"
-
-SLIDER_CLASSNAME = "org.apache.slider.Slider"
-DEFAULT_JVM__OPTS = "-Djava.net.preferIPv4Stack=true -Djava.awt.headless=true -Xmx256m -Djava.confdir=%s"
-
-"""
-Launches slider
-
-
-"""
-
-
-
-def scriptDir():
- """
- get the script path
- """
- return os.path.dirname(os.path.realpath(__file__))
-
-def sliderDir():
- return os.path.dirname(scriptDir())
-
-def libDir(sliderdir) :
- return os.path.join(sliderdir, LIB)
-
-def confDir(sliderdir):
- """
- determine the active configuration directory
- :param sliderdir: slider directory
- :return: the configuration directory -any env var will
- override the relative path
- """
- localconf = os.path.join(sliderdir, CONF)
- return os.environ.get(SLIDER_CONF_DIR,localconf)
-
-def dirMustExist(dir):
- if not os.path.exists(dir):
- raise Exception("Directory does not exist: %s " % dir)
- return dir
-
-def read(pipe, line):
- """
- read a char, append to the listing if there is a char that is not \n
- :param pipe: pipe to read from
- :param line: line being built up
- :return: (the potentially updated line, flag indicating newline reached)
- """
-
- c = pipe.read(1)
- if c != "":
- o = c.decode('utf-8')
- if o != '\n':
- line += o
- return line, False
- else:
- return line, True
- else:
- return line, False
-
-
-
-def usage():
- print "Usage: slider <action> <arguments>"
- return 1
-
-
-def main():
- """
- Slider main method
- :return: exit code of the process
- """
- if len(sys.argv)==1 :
- return usage()
- print "stdout encoding: "+ sys.stdout.encoding
- args = sys.argv[1:]
- slider_home = sliderDir()
- libdir = dirMustExist(libDir(slider_home))
- confdir = dirMustExist(confDir(slider_home))
- default_jvm_opts = DEFAULT_JVM__OPTS % confdir
- slider_jvm_opts = os.environ.get(SLIDER_JVM_OPTS, default_jvm_opts)
- # split the JVM opts by space
- jvm_opts_split = slider_jvm_opts.split()
- slider_classpath_extra = os.environ.get(SLIDER_CLASSPATH_EXTRA, "")
- p = os.pathsep # path separator
- d = os.sep # dir separator
- slider_classpath = libdir + d + "*" + p \
- + confdir + p \
- + slider_classpath_extra
-
-
- print "slider_home = \"%s\"" % slider_home
- print "slider_jvm_opts = \"%s\"" % slider_jvm_opts
- print "slider_classpath = \"%s\"" % slider_classpath
-
- #java = "/usr/bin/java"
- commandline = ["java", ]
- commandline.append("-classpath")
- commandline.append(slider_classpath)
- commandline.extend(jvm_opts_split)
- commandline.append(SLIDER_CLASSNAME)
- commandline.extend(args)
- print "ready to exec : %s" % commandline
- # docs warn of using PIPE on stderr
- exe = subprocess.Popen(commandline,
- stdin=None,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE,
- shell=False)
- stdout = exe.stdout
- stderr = exe.stderr
- outline = ""
- errline = ""
- while exe.poll() is None:
- # process is running; grab output and echo every line
- outline, done = read(stdout, outline)
- if done:
- print outline
- outline = ""
- errline, done = read(stderr, errline)
- if done:
- print errline
- errline = ""
-
- # get tail
- out, err = exe.communicate()
- print outline + out.decode()
- print errline + err.decode()
- return exe.returncode
-
-
-
-if __name__ == '__main__':
- """
- Entry point
- """
- try:
- returncode = main()
- except Exception as e:
- print "Exception: %s " % e.message
- returncode = -1
-
- sys.exit(returncode)
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/1c5f303f/slider-assembly/src/main/scripts/slider.py
----------------------------------------------------------------------
diff --git a/slider-assembly/src/main/scripts/slider.py b/slider-assembly/src/main/scripts/slider.py
new file mode 100644
index 0000000..d48eca6
--- /dev/null
+++ b/slider-assembly/src/main/scripts/slider.py
@@ -0,0 +1,169 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# 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.
+import sys
+import os
+import subprocess
+
+CONF = "conf"
+
+LIB = "lib"
+
+SLIDER_CONF_DIR = "SLIDER_CONF_DIR"
+SLIDER_JVM_OPTS = "SLIDER_JVM_OPTS"
+SLIDER_CLASSPATH_EXTRA = "SLIDER_CLASSPATH_EXTRA"
+
+SLIDER_CLASSNAME = "org.apache.slider.Slider"
+DEFAULT_JVM__OPTS = "-Djava.net.preferIPv4Stack=true -Djava.awt.headless=true -Xmx256m -Djava.confdir=%s"
+
+"""
+Launches slider
+
+
+"""
+
+
+
+def scriptDir():
+ """
+ get the script path
+ """
+ return os.path.dirname(os.path.realpath(__file__))
+
+def sliderDir():
+ return os.path.dirname(scriptDir())
+
+def libDir(sliderdir) :
+ return os.path.join(sliderdir, LIB)
+
+def confDir(sliderdir):
+ """
+ determine the active configuration directory
+ :param sliderdir: slider directory
+ :return: the configuration directory -any env var will
+ override the relative path
+ """
+ localconf = os.path.join(sliderdir, CONF)
+ return os.environ.get(SLIDER_CONF_DIR,localconf)
+
+def dirMustExist(dir):
+ if not os.path.exists(dir):
+ raise Exception("Directory does not exist: %s " % dir)
+ return dir
+
+def read(pipe, line):
+ """
+ read a char, append to the listing if there is a char that is not \n
+ :param pipe: pipe to read from
+ :param line: line being built up
+ :return: (the potentially updated line, flag indicating newline reached)
+ """
+
+ c = pipe.read(1)
+ if c != "":
+ o = c.decode('utf-8')
+ if o != '\n':
+ line += o
+ return line, False
+ else:
+ return line, True
+ else:
+ return line, False
+
+
+
+def usage():
+ print "Usage: slider <action> <arguments>"
+ return 1
+
+
+def main():
+ """
+ Slider main method
+ :return: exit code of the process
+ """
+ if len(sys.argv)==1 :
+ return usage()
+ print "stdout encoding: "+ sys.stdout.encoding
+ args = sys.argv[1:]
+ slider_home = sliderDir()
+ libdir = dirMustExist(libDir(slider_home))
+ confdir = dirMustExist(confDir(slider_home))
+ default_jvm_opts = DEFAULT_JVM__OPTS % confdir
+ slider_jvm_opts = os.environ.get(SLIDER_JVM_OPTS, default_jvm_opts)
+ # split the JVM opts by space
+ jvm_opts_split = slider_jvm_opts.split()
+ slider_classpath_extra = os.environ.get(SLIDER_CLASSPATH_EXTRA, "")
+ p = os.pathsep # path separator
+ d = os.sep # dir separator
+ slider_classpath = libdir + d + "*" + p \
+ + confdir + p \
+ + slider_classpath_extra
+
+
+ print "slider_home = \"%s\"" % slider_home
+ print "slider_jvm_opts = \"%s\"" % slider_jvm_opts
+ print "slider_classpath = \"%s\"" % slider_classpath
+
+ #java = "/usr/bin/java"
+ commandline = ["java", ]
+ commandline.append("-classpath")
+ commandline.append(slider_classpath)
+ commandline.extend(jvm_opts_split)
+ commandline.append(SLIDER_CLASSNAME)
+ commandline.extend(args)
+ print "ready to exec : %s" % commandline
+ # docs warn of using PIPE on stderr
+ exe = subprocess.Popen(commandline,
+ stdin=None,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ shell=False)
+ stdout = exe.stdout
+ stderr = exe.stderr
+ outline = ""
+ errline = ""
+ while exe.poll() is None:
+ # process is running; grab output and echo every line
+ outline, done = read(stdout, outline)
+ if done:
+ print outline
+ outline = ""
+ errline, done = read(stderr, errline)
+ if done:
+ print errline
+ errline = ""
+
+ # get tail
+ out, err = exe.communicate()
+ print outline + out.decode()
+ print errline + err.decode()
+ return exe.returncode
+
+
+
+if __name__ == '__main__':
+ """
+ Entry point
+ """
+ try:
+ returncode = main()
+ except Exception as e:
+ print "Exception: %s " % e.message
+ returncode = -1
+
+ sys.exit(returncode)
[09/14] git commit: SLIDER-153 add JVM args to CLI
Posted by st...@apache.org.
SLIDER-153 add JVM args to CLI
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/8a8ffd94
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/8a8ffd94
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/8a8ffd94
Branch: refs/heads/develop
Commit: 8a8ffd94c9b9685df578ba493e6cb0148af0e5b1
Parents: 77f3e02
Author: Steve Loughran <st...@apache.org>
Authored: Tue Jun 24 13:19:49 2014 -0700
Committer: Steve Loughran <st...@apache.org>
Committed: Tue Jun 24 13:19:49 2014 -0700
----------------------------------------------------------------------
slider-assembly/src/main/scripts/slider.py | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/8a8ffd94/slider-assembly/src/main/scripts/slider.py
----------------------------------------------------------------------
diff --git a/slider-assembly/src/main/scripts/slider.py b/slider-assembly/src/main/scripts/slider.py
index 77c39aa..d48eca6 100644
--- a/slider-assembly/src/main/scripts/slider.py
+++ b/slider-assembly/src/main/scripts/slider.py
@@ -30,14 +30,12 @@ SLIDER_CLASSPATH_EXTRA = "SLIDER_CLASSPATH_EXTRA"
SLIDER_CLASSNAME = "org.apache.slider.Slider"
DEFAULT_JVM__OPTS = "-Djava.net.preferIPv4Stack=true -Djava.awt.headless=true -Xmx256m -Djava.confdir=%s"
-"""Launches slider
-
-
"""
+Launches slider
+"""
-print os.environ['HOME']
def scriptDir():
@@ -107,6 +105,8 @@ def main():
confdir = dirMustExist(confDir(slider_home))
default_jvm_opts = DEFAULT_JVM__OPTS % confdir
slider_jvm_opts = os.environ.get(SLIDER_JVM_OPTS, default_jvm_opts)
+ # split the JVM opts by space
+ jvm_opts_split = slider_jvm_opts.split()
slider_classpath_extra = os.environ.get(SLIDER_CLASSPATH_EXTRA, "")
p = os.pathsep # path separator
d = os.sep # dir separator
@@ -120,12 +120,11 @@ def main():
print "slider_classpath = \"%s\"" % slider_classpath
#java = "/usr/bin/java"
- java = "java"
- commandline = [java,
- "-classpath",
- slider_classpath,
- SLIDER_CLASSNAME]
- # commandline.append(slider_jvm_opts)
+ commandline = ["java", ]
+ commandline.append("-classpath")
+ commandline.append(slider_classpath)
+ commandline.extend(jvm_opts_split)
+ commandline.append(SLIDER_CLASSNAME)
commandline.extend(args)
print "ready to exec : %s" % commandline
# docs warn of using PIPE on stderr
[08/14] git commit: SLIDER-153 fix shebang line
Posted by st...@apache.org.
SLIDER-153 fix shebang line
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/77f3e021
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/77f3e021
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/77f3e021
Branch: refs/heads/develop
Commit: 77f3e02186cf1e55857eb991c216e94ef4f85c49
Parents: 6fc569d
Author: Steve Loughran <st...@apache.org>
Authored: Tue Jun 24 13:18:50 2014 -0700
Committer: Steve Loughran <st...@apache.org>
Committed: Tue Jun 24 13:18:50 2014 -0700
----------------------------------------------------------------------
slider-assembly/src/main/scripts/slider.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/77f3e021/slider-assembly/src/main/scripts/slider.py
----------------------------------------------------------------------
diff --git a/slider-assembly/src/main/scripts/slider.py b/slider-assembly/src/main/scripts/slider.py
index 1e55cc6..77c39aa 100644
--- a/slider-assembly/src/main/scripts/slider.py
+++ b/slider-assembly/src/main/scripts/slider.py
@@ -1,4 +1,4 @@
-# !/usr/bin/env python
+#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one or more
[10/14] git commit: SLIDER-153 bin/slider is now python
Posted by st...@apache.org.
SLIDER-153 bin/slider is now python
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/6f05995e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/6f05995e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/6f05995e
Branch: refs/heads/develop
Commit: 6f05995e42c767062500da68759f75e7f66fd05c
Parents: 8a8ffd9
Author: Steve Loughran <st...@apache.org>
Authored: Tue Jun 24 16:08:58 2014 -0700
Committer: Steve Loughran <st...@apache.org>
Committed: Tue Jun 24 16:08:58 2014 -0700
----------------------------------------------------------------------
slider-assembly/src/main/scripts/slider | 217 +++++++++++++++++-------
slider-assembly/src/main/scripts/slider.py | 169 ------------------
slider-assembly/src/main/scripts/slider.sh | 74 ++++++++
3 files changed, 230 insertions(+), 230 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/6f05995e/slider-assembly/src/main/scripts/slider
----------------------------------------------------------------------
diff --git a/slider-assembly/src/main/scripts/slider b/slider-assembly/src/main/scripts/slider
old mode 100755
new mode 100644
index caf275b..d48eca6
--- a/slider-assembly/src/main/scripts/slider
+++ b/slider-assembly/src/main/scripts/slider
@@ -1,5 +1,6 @@
-#!/usr/bin/env bash
-
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
# 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.
@@ -7,68 +8,162 @@
# (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
+# 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.
-
-
-# this is the shell script to start Slider deploying an application
-# Usage: slider <action> <commands>
-
-# The env variable SLIDER_JVM_OPTS can be used to override
-# the default JVM opts
-
-function usage
-{
- echo "Usage: slider <action> <arguments>"
- echo ""
-}
-
-# Slider works out its own location
-this="${BASH_SOURCE-$0}"
-bindir=$(cd -P -- "$(dirname -- "$this")" && pwd -P)
-script="$(basename -- "$this")"
-
-# lib directory is one up; it is expected to contain
-# slider.jar and any other dependencies that are not in the
-# standard Hadoop classpath
-
-slider_home="${bindir}/.."
-slider_home=`cd -P "${slider_home}" && pwd -P`
-
-libdir="${slider_home}/lib"
-libdir=`cd -P "${libdir}" && pwd -P`
-
-
-confdir="${slider_home}/conf"
-
-# normalize the conf dir so it can be passed down
-confdir=`cd -P "${confdir}" && pwd -P`
-confdir=${SLIDER_CONF_DIR:-$confdir}
-
-
-slider_jvm_opts="-Djava.net.preferIPv4Stack=true -Djava.awt.headless=true -Xmx256m -Djava.confdir=${confdir}"
-slider_jvm_opts=${SLIDER_JVM_OPTS:-$slider_jvm_opts}
-
-# allow for an extra classpath
-slider_classpath_extra=${SLIDER_CLASSPATH_EXTRA:-""}
-
-slider_classpath="${libdir}/*:${confdir}:${slider_classpath_extra}"
-
-launcher=org.apache.slider.Slider
-
-
-echo "slider_home = \"${slider_home}\""
-echo "slider_jvm_opts = \"${slider_jvm_opts}\""
-echo "classpath = \"${slider_classpath}\""
-export CLASSPATH="${slider_classpath}"
-echo ""
-
-echo "command is java ${slider_jvm_opts} --classpath \"${slider_classpath}\" ${launcher} $@"
-echo ""
-echo ""
-exec java ${slider_jvm_opts} ${launcher} $@
+import sys
+import os
+import subprocess
+
+CONF = "conf"
+
+LIB = "lib"
+
+SLIDER_CONF_DIR = "SLIDER_CONF_DIR"
+SLIDER_JVM_OPTS = "SLIDER_JVM_OPTS"
+SLIDER_CLASSPATH_EXTRA = "SLIDER_CLASSPATH_EXTRA"
+
+SLIDER_CLASSNAME = "org.apache.slider.Slider"
+DEFAULT_JVM__OPTS = "-Djava.net.preferIPv4Stack=true -Djava.awt.headless=true -Xmx256m -Djava.confdir=%s"
+
+"""
+Launches slider
+
+
+"""
+
+
+
+def scriptDir():
+ """
+ get the script path
+ """
+ return os.path.dirname(os.path.realpath(__file__))
+
+def sliderDir():
+ return os.path.dirname(scriptDir())
+
+def libDir(sliderdir) :
+ return os.path.join(sliderdir, LIB)
+
+def confDir(sliderdir):
+ """
+ determine the active configuration directory
+ :param sliderdir: slider directory
+ :return: the configuration directory -any env var will
+ override the relative path
+ """
+ localconf = os.path.join(sliderdir, CONF)
+ return os.environ.get(SLIDER_CONF_DIR,localconf)
+
+def dirMustExist(dir):
+ if not os.path.exists(dir):
+ raise Exception("Directory does not exist: %s " % dir)
+ return dir
+
+def read(pipe, line):
+ """
+ read a char, append to the listing if there is a char that is not \n
+ :param pipe: pipe to read from
+ :param line: line being built up
+ :return: (the potentially updated line, flag indicating newline reached)
+ """
+
+ c = pipe.read(1)
+ if c != "":
+ o = c.decode('utf-8')
+ if o != '\n':
+ line += o
+ return line, False
+ else:
+ return line, True
+ else:
+ return line, False
+
+
+
+def usage():
+ print "Usage: slider <action> <arguments>"
+ return 1
+
+
+def main():
+ """
+ Slider main method
+ :return: exit code of the process
+ """
+ if len(sys.argv)==1 :
+ return usage()
+ print "stdout encoding: "+ sys.stdout.encoding
+ args = sys.argv[1:]
+ slider_home = sliderDir()
+ libdir = dirMustExist(libDir(slider_home))
+ confdir = dirMustExist(confDir(slider_home))
+ default_jvm_opts = DEFAULT_JVM__OPTS % confdir
+ slider_jvm_opts = os.environ.get(SLIDER_JVM_OPTS, default_jvm_opts)
+ # split the JVM opts by space
+ jvm_opts_split = slider_jvm_opts.split()
+ slider_classpath_extra = os.environ.get(SLIDER_CLASSPATH_EXTRA, "")
+ p = os.pathsep # path separator
+ d = os.sep # dir separator
+ slider_classpath = libdir + d + "*" + p \
+ + confdir + p \
+ + slider_classpath_extra
+
+
+ print "slider_home = \"%s\"" % slider_home
+ print "slider_jvm_opts = \"%s\"" % slider_jvm_opts
+ print "slider_classpath = \"%s\"" % slider_classpath
+
+ #java = "/usr/bin/java"
+ commandline = ["java", ]
+ commandline.append("-classpath")
+ commandline.append(slider_classpath)
+ commandline.extend(jvm_opts_split)
+ commandline.append(SLIDER_CLASSNAME)
+ commandline.extend(args)
+ print "ready to exec : %s" % commandline
+ # docs warn of using PIPE on stderr
+ exe = subprocess.Popen(commandline,
+ stdin=None,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ shell=False)
+ stdout = exe.stdout
+ stderr = exe.stderr
+ outline = ""
+ errline = ""
+ while exe.poll() is None:
+ # process is running; grab output and echo every line
+ outline, done = read(stdout, outline)
+ if done:
+ print outline
+ outline = ""
+ errline, done = read(stderr, errline)
+ if done:
+ print errline
+ errline = ""
+
+ # get tail
+ out, err = exe.communicate()
+ print outline + out.decode()
+ print errline + err.decode()
+ return exe.returncode
+
+
+
+if __name__ == '__main__':
+ """
+ Entry point
+ """
+ try:
+ returncode = main()
+ except Exception as e:
+ print "Exception: %s " % e.message
+ returncode = -1
+
+ sys.exit(returncode)
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/6f05995e/slider-assembly/src/main/scripts/slider.py
----------------------------------------------------------------------
diff --git a/slider-assembly/src/main/scripts/slider.py b/slider-assembly/src/main/scripts/slider.py
deleted file mode 100644
index d48eca6..0000000
--- a/slider-assembly/src/main/scripts/slider.py
+++ /dev/null
@@ -1,169 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# 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.
-import sys
-import os
-import subprocess
-
-CONF = "conf"
-
-LIB = "lib"
-
-SLIDER_CONF_DIR = "SLIDER_CONF_DIR"
-SLIDER_JVM_OPTS = "SLIDER_JVM_OPTS"
-SLIDER_CLASSPATH_EXTRA = "SLIDER_CLASSPATH_EXTRA"
-
-SLIDER_CLASSNAME = "org.apache.slider.Slider"
-DEFAULT_JVM__OPTS = "-Djava.net.preferIPv4Stack=true -Djava.awt.headless=true -Xmx256m -Djava.confdir=%s"
-
-"""
-Launches slider
-
-
-"""
-
-
-
-def scriptDir():
- """
- get the script path
- """
- return os.path.dirname(os.path.realpath(__file__))
-
-def sliderDir():
- return os.path.dirname(scriptDir())
-
-def libDir(sliderdir) :
- return os.path.join(sliderdir, LIB)
-
-def confDir(sliderdir):
- """
- determine the active configuration directory
- :param sliderdir: slider directory
- :return: the configuration directory -any env var will
- override the relative path
- """
- localconf = os.path.join(sliderdir, CONF)
- return os.environ.get(SLIDER_CONF_DIR,localconf)
-
-def dirMustExist(dir):
- if not os.path.exists(dir):
- raise Exception("Directory does not exist: %s " % dir)
- return dir
-
-def read(pipe, line):
- """
- read a char, append to the listing if there is a char that is not \n
- :param pipe: pipe to read from
- :param line: line being built up
- :return: (the potentially updated line, flag indicating newline reached)
- """
-
- c = pipe.read(1)
- if c != "":
- o = c.decode('utf-8')
- if o != '\n':
- line += o
- return line, False
- else:
- return line, True
- else:
- return line, False
-
-
-
-def usage():
- print "Usage: slider <action> <arguments>"
- return 1
-
-
-def main():
- """
- Slider main method
- :return: exit code of the process
- """
- if len(sys.argv)==1 :
- return usage()
- print "stdout encoding: "+ sys.stdout.encoding
- args = sys.argv[1:]
- slider_home = sliderDir()
- libdir = dirMustExist(libDir(slider_home))
- confdir = dirMustExist(confDir(slider_home))
- default_jvm_opts = DEFAULT_JVM__OPTS % confdir
- slider_jvm_opts = os.environ.get(SLIDER_JVM_OPTS, default_jvm_opts)
- # split the JVM opts by space
- jvm_opts_split = slider_jvm_opts.split()
- slider_classpath_extra = os.environ.get(SLIDER_CLASSPATH_EXTRA, "")
- p = os.pathsep # path separator
- d = os.sep # dir separator
- slider_classpath = libdir + d + "*" + p \
- + confdir + p \
- + slider_classpath_extra
-
-
- print "slider_home = \"%s\"" % slider_home
- print "slider_jvm_opts = \"%s\"" % slider_jvm_opts
- print "slider_classpath = \"%s\"" % slider_classpath
-
- #java = "/usr/bin/java"
- commandline = ["java", ]
- commandline.append("-classpath")
- commandline.append(slider_classpath)
- commandline.extend(jvm_opts_split)
- commandline.append(SLIDER_CLASSNAME)
- commandline.extend(args)
- print "ready to exec : %s" % commandline
- # docs warn of using PIPE on stderr
- exe = subprocess.Popen(commandline,
- stdin=None,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE,
- shell=False)
- stdout = exe.stdout
- stderr = exe.stderr
- outline = ""
- errline = ""
- while exe.poll() is None:
- # process is running; grab output and echo every line
- outline, done = read(stdout, outline)
- if done:
- print outline
- outline = ""
- errline, done = read(stderr, errline)
- if done:
- print errline
- errline = ""
-
- # get tail
- out, err = exe.communicate()
- print outline + out.decode()
- print errline + err.decode()
- return exe.returncode
-
-
-
-if __name__ == '__main__':
- """
- Entry point
- """
- try:
- returncode = main()
- except Exception as e:
- print "Exception: %s " % e.message
- returncode = -1
-
- sys.exit(returncode)
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/6f05995e/slider-assembly/src/main/scripts/slider.sh
----------------------------------------------------------------------
diff --git a/slider-assembly/src/main/scripts/slider.sh b/slider-assembly/src/main/scripts/slider.sh
new file mode 100755
index 0000000..caf275b
--- /dev/null
+++ b/slider-assembly/src/main/scripts/slider.sh
@@ -0,0 +1,74 @@
+#!/usr/bin/env bash
+
+# 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.
+
+
+# this is the shell script to start Slider deploying an application
+# Usage: slider <action> <commands>
+
+# The env variable SLIDER_JVM_OPTS can be used to override
+# the default JVM opts
+
+function usage
+{
+ echo "Usage: slider <action> <arguments>"
+ echo ""
+}
+
+# Slider works out its own location
+this="${BASH_SOURCE-$0}"
+bindir=$(cd -P -- "$(dirname -- "$this")" && pwd -P)
+script="$(basename -- "$this")"
+
+# lib directory is one up; it is expected to contain
+# slider.jar and any other dependencies that are not in the
+# standard Hadoop classpath
+
+slider_home="${bindir}/.."
+slider_home=`cd -P "${slider_home}" && pwd -P`
+
+libdir="${slider_home}/lib"
+libdir=`cd -P "${libdir}" && pwd -P`
+
+
+confdir="${slider_home}/conf"
+
+# normalize the conf dir so it can be passed down
+confdir=`cd -P "${confdir}" && pwd -P`
+confdir=${SLIDER_CONF_DIR:-$confdir}
+
+
+slider_jvm_opts="-Djava.net.preferIPv4Stack=true -Djava.awt.headless=true -Xmx256m -Djava.confdir=${confdir}"
+slider_jvm_opts=${SLIDER_JVM_OPTS:-$slider_jvm_opts}
+
+# allow for an extra classpath
+slider_classpath_extra=${SLIDER_CLASSPATH_EXTRA:-""}
+
+slider_classpath="${libdir}/*:${confdir}:${slider_classpath_extra}"
+
+launcher=org.apache.slider.Slider
+
+
+echo "slider_home = \"${slider_home}\""
+echo "slider_jvm_opts = \"${slider_jvm_opts}\""
+echo "classpath = \"${slider_classpath}\""
+export CLASSPATH="${slider_classpath}"
+echo ""
+
+echo "command is java ${slider_jvm_opts} --classpath \"${slider_classpath}\" ${launcher} $@"
+echo ""
+echo ""
+exec java ${slider_jvm_opts} ${launcher} $@
[06/14] git commit: SLIDER-153 python script working: stdout and
stderr is being printed after the end of the process
Posted by st...@apache.org.
SLIDER-153 python script working: stdout and stderr is being printed after the end of the process
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/06816c4c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/06816c4c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/06816c4c
Branch: refs/heads/develop
Commit: 06816c4cd6ffbb94014ff95250f26c5028723a09
Parents: acdfe5b
Author: Steve Loughran <st...@apache.org>
Authored: Tue Jun 24 10:52:10 2014 -0700
Committer: Steve Loughran <st...@apache.org>
Committed: Tue Jun 24 10:52:10 2014 -0700
----------------------------------------------------------------------
slider-assembly/src/main/scripts/slider.py | 28 ++++++++++++++++---------
1 file changed, 18 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/06816c4c/slider-assembly/src/main/scripts/slider.py
----------------------------------------------------------------------
diff --git a/slider-assembly/src/main/scripts/slider.py b/slider-assembly/src/main/scripts/slider.py
index 2c1f4b3..cfad59a 100644
--- a/slider-assembly/src/main/scripts/slider.py
+++ b/slider-assembly/src/main/scripts/slider.py
@@ -97,21 +97,27 @@ def main():
print "slider_home = \"%s\"" % slider_home
print "slider_jvm_opts = \"%s\"" % slider_jvm_opts
print "slider_classpath = \"%s\"" % slider_classpath
-
-
- commandline = ["java",]
+
+ #java = "/usr/bin/java"
+ java = "java"
+ commandline = [java,
+ "-classpath",
+ slider_classpath,
+ SLIDER_CLASSNAME]
# commandline.append(slider_jvm_opts)
- commandline.append("-classpath")
- commandline.append(slider_classpath)
- commandline.append(SLIDER_CLASSNAME)
commandline.extend(args)
print "ready to exec : %s" % commandline
# docs warn of using PIPE on stderr
- return subprocess.call(commandline,
- stdin=None,
+ exe = subprocess.Popen(commandline,
+ stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT,
+ stderr=subprocess.PIPE,
shell=False)
+ exe.wait()
+ out, err = exe.communicate()
+ print "stdout : ", out.decode()
+ print "stderr : ", err.decode()
+ return exe.returncode
@@ -122,7 +128,9 @@ if __name__ == '__main__':
try:
rv = main()
if rv != 0:
- print "exit code = %d" % rv
+ print "Failed with exit code = %d" % rv
+ else:
+ print "Success"
except Exception as e:
print "Exception: %s " % e.message
rv = -1
[13/14] git commit: Merge branch
'feature/SLIDER-153_add_slider_py_command' into develop
Posted by st...@apache.org.
Merge branch 'feature/SLIDER-153_add_slider_py_command' into develop
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/7089fa0f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/7089fa0f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/7089fa0f
Branch: refs/heads/develop
Commit: 7089fa0fbd6d1cb8c92eb1a360cdd82429321bdf
Parents: 1866733 150b589
Author: Steve Loughran <st...@apache.org>
Authored: Wed Jun 25 11:22:59 2014 -0700
Committer: Steve Loughran <st...@apache.org>
Committed: Wed Jun 25 11:22:59 2014 -0700
----------------------------------------------------------------------
slider-assembly/src/main/scripts/slider | 1 -
slider-assembly/src/main/scripts/slider.py | 169 ++++++++++++++++++++++++
2 files changed, 169 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
[05/14] git commit: SLIDER-153 more on execing scripts
Posted by st...@apache.org.
SLIDER-153 more on execing scripts
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/acdfe5bd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/acdfe5bd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/acdfe5bd
Branch: refs/heads/develop
Commit: acdfe5bd6dfe59daca573a5e28271d9950467b16
Parents: 918e746
Author: Steve Loughran <st...@apache.org>
Authored: Mon Jun 23 14:47:28 2014 -0700
Committer: Steve Loughran <st...@apache.org>
Committed: Mon Jun 23 14:47:28 2014 -0700
----------------------------------------------------------------------
slider-assembly/src/main/scripts/slider.py | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/acdfe5bd/slider-assembly/src/main/scripts/slider.py
----------------------------------------------------------------------
diff --git a/slider-assembly/src/main/scripts/slider.py b/slider-assembly/src/main/scripts/slider.py
index e846e64..2c1f4b3 100644
--- a/slider-assembly/src/main/scripts/slider.py
+++ b/slider-assembly/src/main/scripts/slider.py
@@ -89,11 +89,10 @@ def main():
slider_classpath_extra = os.environ.get(SLIDER_CLASSPATH_EXTRA, "")
p = os.pathsep # path separator
d = os.sep # dir separator
- slider_classpath = '"' + \
- libdir + d + "*" + p \
+ slider_classpath = libdir + d + "*" + p \
+ confdir + p \
- + slider_classpath_extra \
- + '"'
+ + slider_classpath_extra
+
print "slider_home = \"%s\"" % slider_home
print "slider_jvm_opts = \"%s\"" % slider_jvm_opts
@@ -111,7 +110,7 @@ def main():
return subprocess.call(commandline,
stdin=None,
stdout=subprocess.PIPE,
- stderr=subprocess.PIPE,
+ stderr=subprocess.STDOUT,
shell=False)
[14/14] git commit: Merge branch 'develop' of
https://git-wip-us.apache.org/repos/asf/incubator-slider into develop
Posted by st...@apache.org.
Merge branch 'develop' of https://git-wip-us.apache.org/repos/asf/incubator-slider into develop
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/9619c335
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/9619c335
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/9619c335
Branch: refs/heads/develop
Commit: 9619c3356f44e91c4cb6de604e0ecfd8c1abcac9
Parents: 7089fa0 93bd8ce
Author: Steve Loughran <st...@apache.org>
Authored: Wed Jun 25 11:23:08 2014 -0700
Committer: Steve Loughran <st...@apache.org>
Committed: Wed Jun 25 11:23:08 2014 -0700
----------------------------------------------------------------------
.../org/apache/slider/server/appmaster/web/SliderAmIpFilter.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
[04/14] git commit: SLIDER-153 building up exec
Posted by st...@apache.org.
SLIDER-153 building up exec
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/918e746d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/918e746d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/918e746d
Branch: refs/heads/develop
Commit: 918e746d83c4ad0f4a25bba39050942f5689599a
Parents: d6131ca
Author: Steve Loughran <st...@apache.org>
Authored: Mon Jun 23 14:40:34 2014 -0700
Committer: Steve Loughran <st...@apache.org>
Committed: Mon Jun 23 14:40:34 2014 -0700
----------------------------------------------------------------------
slider-assembly/src/main/scripts/slider | 1 -
slider-assembly/src/main/scripts/slider.py | 109 +++++++++++++++++++++++-
2 files changed, 106 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/918e746d/slider-assembly/src/main/scripts/slider
----------------------------------------------------------------------
diff --git a/slider-assembly/src/main/scripts/slider b/slider-assembly/src/main/scripts/slider
index e9522cf..caf275b 100755
--- a/slider-assembly/src/main/scripts/slider
+++ b/slider-assembly/src/main/scripts/slider
@@ -32,7 +32,6 @@ function usage
this="${BASH_SOURCE-$0}"
bindir=$(cd -P -- "$(dirname -- "$this")" && pwd -P)
script="$(basename -- "$this")"
-this="$bin/$script"
# lib directory is one up; it is expected to contain
# slider.jar and any other dependencies that are not in the
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/918e746d/slider-assembly/src/main/scripts/slider.py
----------------------------------------------------------------------
diff --git a/slider-assembly/src/main/scripts/slider.py b/slider-assembly/src/main/scripts/slider.py
index d5891ed..e846e64 100644
--- a/slider-assembly/src/main/scripts/slider.py
+++ b/slider-assembly/src/main/scripts/slider.py
@@ -16,13 +16,116 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
+import os
import subprocess
-# Slider main method
+CONF = "conf"
+
+LIB = "lib"
+
+SLIDER_CONF_DIR = "SLIDER_CONF_DIR"
+SLIDER_JVM_OPTS = "SLIDER_JVM_OPTS"
+SLIDER_CLASSPATH_EXTRA = "SLIDER_CLASSPATH_EXTRA"
+
+SLIDER_CLASSNAME = "org.apache.slider.Slider"
+DEFAULT_JVM__OPTS = "-Djava.net.preferIPv4Stack=true -Djava.awt.headless=true -Xmx256m -Djava.confdir=%s"
+
+"""Launches slider
+
+
+"""
+
+
+
+print os.environ['HOME']
+
+
+def scriptDir():
+ """
+ get the script path
+ """
+ return os.path.dirname(os.path.realpath(__file__))
+
+def sliderDir():
+ return os.path.dirname(scriptDir())
+
+def libDir(sliderdir) :
+ return os.path.join(sliderdir, LIB)
+
+def confDir(sliderdir):
+ """
+ determine the active configuration directory
+ :param sliderdir: slider directory
+ :return: the configuration directory -any env var will
+ override the relative path
+ """
+ localconf = os.path.join(sliderdir, CONF)
+ return os.environ.get(SLIDER_CONF_DIR,localconf)
+
+def dirMustExist(dir):
+ if not os.path.exists(dir):
+ raise Exception("Directory does not exist: %s " % dir)
+ return dir
+
+
+def usage():
+ print "Usage: slider <action> <arguments>"
+ return 1
+
+
def main():
+ """
+ Slider main method
+ :return: exit code of the process
+ """
+ if len(sys.argv)==1 :
+ return usage()
+ args = sys.argv[1:]
+ slider_home = sliderDir()
+ libdir = dirMustExist(libDir(slider_home))
+ confdir = dirMustExist(confDir(slider_home))
+ default_jvm_opts = DEFAULT_JVM__OPTS % confdir
+ slider_jvm_opts = os.environ.get(SLIDER_JVM_OPTS, default_jvm_opts)
+ slider_classpath_extra = os.environ.get(SLIDER_CLASSPATH_EXTRA, "")
+ p = os.pathsep # path separator
+ d = os.sep # dir separator
+ slider_classpath = '"' + \
+ libdir + d + "*" + p \
+ + confdir + p \
+ + slider_classpath_extra \
+ + '"'
+
+ print "slider_home = \"%s\"" % slider_home
+ print "slider_jvm_opts = \"%s\"" % slider_jvm_opts
+ print "slider_classpath = \"%s\"" % slider_classpath
+ commandline = ["java",]
+ # commandline.append(slider_jvm_opts)
+ commandline.append("-classpath")
+ commandline.append(slider_classpath)
+ commandline.append(SLIDER_CLASSNAME)
+ commandline.extend(args)
+ print "ready to exec : %s" % commandline
+ # docs warn of using PIPE on stderr
+ return subprocess.call(commandline,
+ stdin=None,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ shell=False)
+
+
+
+
+
if __name__ == '__main__':
- print "slider python script"
+ print "slider python script"
+ try:
rv = main()
- sys.exit(rv)
+ if rv != 0:
+ print "exit code = %d" % rv
+ except Exception as e:
+ print "Exception: %s " % e.message
+ rv = -1
+
+ sys.exit(rv)
[07/14] git commit: SLIDER-153: output streaming now working
Posted by st...@apache.org.
SLIDER-153: output streaming now working
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/6fc569de
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/6fc569de
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/6fc569de
Branch: refs/heads/develop
Commit: 6fc569de084dbba6a9701bba5595f557d1029484
Parents: 06816c4
Author: Steve Loughran <st...@apache.org>
Authored: Tue Jun 24 13:01:37 2014 -0700
Committer: Steve Loughran <st...@apache.org>
Committed: Tue Jun 24 13:01:37 2014 -0700
----------------------------------------------------------------------
slider-assembly/src/main/scripts/slider.py | 60 +++++++++++++++++++------
1 file changed, 46 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/6fc569de/slider-assembly/src/main/scripts/slider.py
----------------------------------------------------------------------
diff --git a/slider-assembly/src/main/scripts/slider.py b/slider-assembly/src/main/scripts/slider.py
index cfad59a..1e55cc6 100644
--- a/slider-assembly/src/main/scripts/slider.py
+++ b/slider-assembly/src/main/scripts/slider.py
@@ -67,6 +67,26 @@ def dirMustExist(dir):
raise Exception("Directory does not exist: %s " % dir)
return dir
+def read(pipe, line):
+ """
+ read a char, append to the listing if there is a char that is not \n
+ :param pipe: pipe to read from
+ :param line: line being built up
+ :return: (the potentially updated line, flag indicating newline reached)
+ """
+
+ c = pipe.read(1)
+ if c != "":
+ o = c.decode('utf-8')
+ if o != '\n':
+ line += o
+ return line, False
+ else:
+ return line, True
+ else:
+ return line, False
+
+
def usage():
print "Usage: slider <action> <arguments>"
@@ -80,6 +100,7 @@ def main():
"""
if len(sys.argv)==1 :
return usage()
+ print "stdout encoding: "+ sys.stdout.encoding
args = sys.argv[1:]
slider_home = sliderDir()
libdir = dirMustExist(libDir(slider_home))
@@ -109,30 +130,41 @@ def main():
print "ready to exec : %s" % commandline
# docs warn of using PIPE on stderr
exe = subprocess.Popen(commandline,
- stdin=subprocess.PIPE,
+ stdin=None,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=False)
- exe.wait()
+ stdout = exe.stdout
+ stderr = exe.stderr
+ outline = ""
+ errline = ""
+ while exe.poll() is None:
+ # process is running; grab output and echo every line
+ outline, done = read(stdout, outline)
+ if done:
+ print outline
+ outline = ""
+ errline, done = read(stderr, errline)
+ if done:
+ print errline
+ errline = ""
+
+ # get tail
out, err = exe.communicate()
- print "stdout : ", out.decode()
- print "stderr : ", err.decode()
+ print outline + out.decode()
+ print errline + err.decode()
return exe.returncode
-
-
if __name__ == '__main__':
- print "slider python script"
+ """
+ Entry point
+ """
try:
- rv = main()
- if rv != 0:
- print "Failed with exit code = %d" % rv
- else:
- print "Success"
+ returncode = main()
except Exception as e:
print "Exception: %s " % e.message
- rv = -1
+ returncode = -1
- sys.exit(rv)
+ sys.exit(returncode)
[12/14] git commit: SLIDER-153 revert rename -> slider for bash
Posted by st...@apache.org.
SLIDER-153 revert rename -> slider for bash
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/150b589b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/150b589b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/150b589b
Branch: refs/heads/develop
Commit: 150b589b72dae4c4b857a6b19205f6ce11f63d39
Parents: 1c5f303
Author: Steve Loughran <st...@apache.org>
Authored: Wed Jun 25 11:22:20 2014 -0700
Committer: Steve Loughran <st...@apache.org>
Committed: Wed Jun 25 11:22:20 2014 -0700
----------------------------------------------------------------------
slider-assembly/src/main/scripts/slider | 74 +++++++++++++++++++++++++
slider-assembly/src/main/scripts/slider.sh | 74 -------------------------
2 files changed, 74 insertions(+), 74 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/150b589b/slider-assembly/src/main/scripts/slider
----------------------------------------------------------------------
diff --git a/slider-assembly/src/main/scripts/slider b/slider-assembly/src/main/scripts/slider
new file mode 100755
index 0000000..caf275b
--- /dev/null
+++ b/slider-assembly/src/main/scripts/slider
@@ -0,0 +1,74 @@
+#!/usr/bin/env bash
+
+# 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.
+
+
+# this is the shell script to start Slider deploying an application
+# Usage: slider <action> <commands>
+
+# The env variable SLIDER_JVM_OPTS can be used to override
+# the default JVM opts
+
+function usage
+{
+ echo "Usage: slider <action> <arguments>"
+ echo ""
+}
+
+# Slider works out its own location
+this="${BASH_SOURCE-$0}"
+bindir=$(cd -P -- "$(dirname -- "$this")" && pwd -P)
+script="$(basename -- "$this")"
+
+# lib directory is one up; it is expected to contain
+# slider.jar and any other dependencies that are not in the
+# standard Hadoop classpath
+
+slider_home="${bindir}/.."
+slider_home=`cd -P "${slider_home}" && pwd -P`
+
+libdir="${slider_home}/lib"
+libdir=`cd -P "${libdir}" && pwd -P`
+
+
+confdir="${slider_home}/conf"
+
+# normalize the conf dir so it can be passed down
+confdir=`cd -P "${confdir}" && pwd -P`
+confdir=${SLIDER_CONF_DIR:-$confdir}
+
+
+slider_jvm_opts="-Djava.net.preferIPv4Stack=true -Djava.awt.headless=true -Xmx256m -Djava.confdir=${confdir}"
+slider_jvm_opts=${SLIDER_JVM_OPTS:-$slider_jvm_opts}
+
+# allow for an extra classpath
+slider_classpath_extra=${SLIDER_CLASSPATH_EXTRA:-""}
+
+slider_classpath="${libdir}/*:${confdir}:${slider_classpath_extra}"
+
+launcher=org.apache.slider.Slider
+
+
+echo "slider_home = \"${slider_home}\""
+echo "slider_jvm_opts = \"${slider_jvm_opts}\""
+echo "classpath = \"${slider_classpath}\""
+export CLASSPATH="${slider_classpath}"
+echo ""
+
+echo "command is java ${slider_jvm_opts} --classpath \"${slider_classpath}\" ${launcher} $@"
+echo ""
+echo ""
+exec java ${slider_jvm_opts} ${launcher} $@
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/150b589b/slider-assembly/src/main/scripts/slider.sh
----------------------------------------------------------------------
diff --git a/slider-assembly/src/main/scripts/slider.sh b/slider-assembly/src/main/scripts/slider.sh
deleted file mode 100755
index caf275b..0000000
--- a/slider-assembly/src/main/scripts/slider.sh
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/env bash
-
-# 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.
-
-
-# this is the shell script to start Slider deploying an application
-# Usage: slider <action> <commands>
-
-# The env variable SLIDER_JVM_OPTS can be used to override
-# the default JVM opts
-
-function usage
-{
- echo "Usage: slider <action> <arguments>"
- echo ""
-}
-
-# Slider works out its own location
-this="${BASH_SOURCE-$0}"
-bindir=$(cd -P -- "$(dirname -- "$this")" && pwd -P)
-script="$(basename -- "$this")"
-
-# lib directory is one up; it is expected to contain
-# slider.jar and any other dependencies that are not in the
-# standard Hadoop classpath
-
-slider_home="${bindir}/.."
-slider_home=`cd -P "${slider_home}" && pwd -P`
-
-libdir="${slider_home}/lib"
-libdir=`cd -P "${libdir}" && pwd -P`
-
-
-confdir="${slider_home}/conf"
-
-# normalize the conf dir so it can be passed down
-confdir=`cd -P "${confdir}" && pwd -P`
-confdir=${SLIDER_CONF_DIR:-$confdir}
-
-
-slider_jvm_opts="-Djava.net.preferIPv4Stack=true -Djava.awt.headless=true -Xmx256m -Djava.confdir=${confdir}"
-slider_jvm_opts=${SLIDER_JVM_OPTS:-$slider_jvm_opts}
-
-# allow for an extra classpath
-slider_classpath_extra=${SLIDER_CLASSPATH_EXTRA:-""}
-
-slider_classpath="${libdir}/*:${confdir}:${slider_classpath_extra}"
-
-launcher=org.apache.slider.Slider
-
-
-echo "slider_home = \"${slider_home}\""
-echo "slider_jvm_opts = \"${slider_jvm_opts}\""
-echo "classpath = \"${slider_classpath}\""
-export CLASSPATH="${slider_classpath}"
-echo ""
-
-echo "command is java ${slider_jvm_opts} --classpath \"${slider_classpath}\" ${launcher} $@"
-echo ""
-echo ""
-exec java ${slider_jvm_opts} ${launcher} $@
[02/14] git commit: Merge branch 'develop' into
feature/SLIDER-153_add_slider_py_command
Posted by st...@apache.org.
Merge branch 'develop' into feature/SLIDER-153_add_slider_py_command
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/e519fbcc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/e519fbcc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/e519fbcc
Branch: refs/heads/develop
Commit: e519fbcc645894541bdf93d1fef9ceba36ded847
Parents: 19d313d 537d87c
Author: Steve Loughran <st...@apache.org>
Authored: Mon Jun 23 13:33:20 2014 -0700
Committer: Steve Loughran <st...@apache.org>
Committed: Mon Jun 23 13:33:20 2014 -0700
----------------------------------------------------------------------
app-packages/hbase-v0_96/README.txt | 33 --
app-packages/hbase-v0_96/appConfig.json | 67 ----
.../hbase-v0_96/configuration/global.xml | 160 --------
.../hbase-v0_96/configuration/hbase-log4j.xml | 142 --------
.../hbase-v0_96/configuration/hbase-policy.xml | 53 ---
.../hbase-v0_96/configuration/hbase-site.xml | 365 -------------------
app-packages/hbase-v0_96/ganglia_metrics.json | 38 --
app-packages/hbase-v0_96/jmx_metrics.json | 56 ---
app-packages/hbase-v0_96/metainfo.xml | 109 ------
.../hbase-0.96.1-hadoop2-bin.tar.gz.REPLACE | 16 -
.../hbase-v0_96/package/scripts/__init__.py | 19 -
.../hbase-v0_96/package/scripts/functions.py | 40 --
.../hbase-v0_96/package/scripts/hbase.py | 125 -------
.../hbase-v0_96/package/scripts/hbase_client.py | 43 ---
.../hbase-v0_96/package/scripts/hbase_master.py | 63 ----
.../package/scripts/hbase_regionserver.py | 66 ----
.../package/scripts/hbase_service.py | 45 ---
.../hbase-v0_96/package/scripts/params.py | 109 ------
.../package/scripts/status_params.py | 26 --
...-metrics2-hbase.properties-GANGLIA-MASTER.j2 | 62 ----
...doop-metrics2-hbase.properties-GANGLIA-RS.j2 | 62 ----
.../package/templates/hbase-env.sh.j2 | 81 ----
.../package/templates/hbase_client_jaas.conf.j2 | 22 --
.../package/templates/hbase_master_jaas.conf.j2 | 25 --
.../templates/hbase_regionserver_jaas.conf.j2 | 25 --
.../package/templates/regionservers.j2 | 20 -
app-packages/hbase-v0_96/resources.json | 19 -
app-packages/hbase/README.txt | 8 +-
slider-agent/conf/agent.ini | 2 +
.../src/main/python/agent/AgentConfig.py | 21 ++
slider-agent/src/main/python/agent/Constants.py | 3 +
.../src/main/python/agent/Controller.py | 23 +-
slider-agent/src/main/python/agent/main.py | 4 +
.../src/test/python/agent/TestController.py | 30 ++
slider-agent/src/test/python/agent/TestMain.py | 5 +-
.../providers/AbstractProviderService.java | 15 +-
.../slider/providers/ProviderService.java | 5 +-
.../slider/providers/agent/AgentKeys.java | 3 +
.../providers/agent/AgentLaunchParameter.java | 130 +++++++
.../providers/agent/AgentProviderService.java | 179 +++++++--
.../slider/providers/agent/AgentRoles.java | 18 +-
.../apache/slider/providers/agent/Command.java | 13 +-
.../slider/providers/agent/CommandResult.java | 16 +-
.../providers/agent/ComponentInstanceState.java | 24 ++
.../slider/providers/agent/ContainerState.java | 41 +++
.../providers/agent/HeartbeatMonitor.java | 116 ++++++
.../server/appmaster/AMViewForProviders.java | 27 ++
.../server/appmaster/SliderAppMaster.java | 32 +-
.../slider/server/appmaster/state/AppState.java | 20 +
.../services/workflow/ForkedProcessService.java | 25 +-
.../services/workflow/LongLivedProcess.java | 13 +
.../test_command_log/appConfig_fast_no_reg.json | 29 ++
.../test_command_log/appConfig_no_hb.json | 29 ++
.../model/mock/MockProviderService.groovy | 4 +-
.../agent/TestAgentLaunchParameter.java | 76 ++++
.../providers/agent/TestHeartbeatMonitor.java | 136 +++++++
.../publisher/TestAgentProviderService.java | 5 +-
.../TestWorkflowForkedProcessService.java | 3 +-
.../lifecycle/AgentCommandTestBase.groovy | 100 +++--
.../lifecycle/TestAgentClusterLifecycle.groovy | 2 +-
.../funtest/lifecycle/TestAgentFailures.groovy | 103 ++++++
.../funtest/lifecycle/TestAgentFailures2.groovy | 103 ++++++
.../lifecycle/TestAppsThroughAgent.groovy | 90 ++---
.../providers/hbase/HBaseProviderService.java | 13 +-
.../slider_specs/creating_app_definitions.md | 80 ++--
65 files changed, 1349 insertions(+), 2088 deletions(-)
----------------------------------------------------------------------