Merge branch 'branch-3.0-perf' into trunk
diff --git a/ambari-metrics-host-monitoring/src/main/python/psutil/build.py b/ambari-metrics-host-monitoring/src/main/python/psutil/build.py
index 09fb411..7aefe25 100644
--- a/ambari-metrics-host-monitoring/src/main/python/psutil/build.py
+++ b/ambari-metrics-host-monitoring/src/main/python/psutil/build.py
@@ -18,7 +18,7 @@
limitations under the License.
'''
-from subprocess import call
+from ambari_commons.subprocess32 import call
import sys
import os
import shutil
diff --git a/ambari-metrics-host-monitoring/src/main/python/psutil/psutil/__init__.py b/ambari-metrics-host-monitoring/src/main/python/psutil/psutil/__init__.py
index 3068b10..13e0d92 100644
--- a/ambari-metrics-host-monitoring/src/main/python/psutil/psutil/__init__.py
+++ b/ambari-metrics-host-monitoring/src/main/python/psutil/psutil/__init__.py
@@ -44,7 +44,7 @@
import signal
import warnings
import errno
-import subprocess
+from ambari_commons import subprocess32
try:
import pwd
except ImportError:
@@ -1163,14 +1163,14 @@
# =====================================================================
class Popen(Process):
- """A more convenient interface to stdlib subprocess module.
+ """A more convenient interface to stdlib subprocess32 module.
It starts a sub process and deals with it exactly as when using
- subprocess.Popen class but in addition also provides all the
+ subprocess32.Popen class but in addition also provides all the
properties and methods of psutil.Process class as a unified
interface:
>>> import psutil
- >>> from subprocess import PIPE
+ >>> from ambari_commons.subprocess32 import PIPE
>>> p = psutil.Popen(["python", "-c", "print 'hi'"], stdout=PIPE)
>>> p.name()
'python'
@@ -1188,24 +1188,24 @@
For method names common to both classes such as kill(), terminate()
and wait(), psutil.Process implementation takes precedence.
- Unlike subprocess.Popen this class pre-emptively checks wheter PID
+ Unlike subprocess32.Popen this class pre-emptively checks wheter PID
has been reused on send_signal(), terminate() and kill() so that
you don't accidentally terminate another process, fixing
http://bugs.python.org/issue6973.
For a complete documentation refer to:
- http://docs.python.org/library/subprocess.html
+ http://docs.python.org/library/subprocess32.html
"""
def __init__(self, *args, **kwargs):
# Explicitly avoid to raise NoSuchProcess in case the process
- # spawned by subprocess.Popen terminates too quickly, see:
+ # spawned by subprocess32.Popen terminates too quickly, see:
# https://code.google.com/p/psutil/issues/detail?id=193
- self.__subproc = subprocess.Popen(*args, **kwargs)
+ self.__subproc = subprocess32.Popen(*args, **kwargs)
self._init(self.__subproc.pid, _ignore_nsp=True)
def __dir__(self):
- return sorted(set(dir(Popen) + dir(subprocess.Popen)))
+ return sorted(set(dir(Popen) + dir(subprocess32.Popen)))
def __getattribute__(self, name):
try:
diff --git a/ambari-metrics-host-monitoring/src/main/python/psutil/psutil/_pssunos.py b/ambari-metrics-host-monitoring/src/main/python/psutil/psutil/_pssunos.py
index bc18427..1552010 100644
--- a/ambari-metrics-host-monitoring/src/main/python/psutil/psutil/_pssunos.py
+++ b/ambari-metrics-host-monitoring/src/main/python/psutil/psutil/_pssunos.py
@@ -9,7 +9,7 @@
import errno
import os
import socket
-import subprocess
+from ambari_commons import subprocess32
import sys
from psutil import _common
@@ -91,7 +91,7 @@
# usr/src/cmd/swap/swap.c
# ...nevertheless I can't manage to obtain the same numbers as 'swap'
# cmdline utility, so let's parse its output (sigh!)
- p = subprocess.Popen(['swap', '-l', '-k'], stdout=subprocess.PIPE)
+ p = subprocess32.Popen(['swap', '-l', '-k'], stdout=subprocess32.PIPE)
stdout, stderr = p.communicate()
if PY3:
stdout = stdout.decode(sys.stdout.encoding)
@@ -433,8 +433,8 @@
# TODO: rewrite this in C (...but the damn netstat source code
# does not include this part! Argh!!)
cmd = "pfiles %s" % pid
- p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
+ p = subprocess32.Popen(cmd, shell=True, stdout=subprocess32.PIPE,
+ stderr=subprocess32.PIPE)
stdout, stderr = p.communicate()
if PY3:
stdout, stderr = [x.decode(sys.stdout.encoding)
diff --git a/ambari-metrics-timelineservice/conf/unix/sqlline/phoenix_utils.py b/ambari-metrics-timelineservice/conf/unix/sqlline/phoenix_utils.py
index 6d9b791..14b53db 100644
--- a/ambari-metrics-timelineservice/conf/unix/sqlline/phoenix_utils.py
+++ b/ambari-metrics-timelineservice/conf/unix/sqlline/phoenix_utils.py
@@ -21,7 +21,7 @@
import os
import fnmatch
-import subprocess
+from ambari_commons import subprocess32
def find(pattern, classPaths):
paths = classPaths.split(os.pathsep)
@@ -62,7 +62,7 @@
def findClasspath(file):
aPath = which(file)
command = "%s%s" %(aPath, ' classpath')
- return subprocess.Popen(command, shell=True, stdout=subprocess.PIPE).stdout.read()
+ return subprocess32.Popen(command, shell=True, stdout=subprocess32.PIPE).stdout.read()
def setPath():
PHOENIX_CLIENT_JAR_PATTERN = "phoenix-*-client.jar"
@@ -167,8 +167,8 @@
:return: shell quoted string
"""
if os.name == 'nt':
- import subprocess
- return subprocess.list2cmdline(args)
+ from ambari_commons import subprocess32
+ return subprocess32.list2cmdline(args)
else:
# pipes module isn't available on Windows
import pipes
diff --git a/ambari-metrics-timelineservice/conf/unix/sqlline/sqlline.py b/ambari-metrics-timelineservice/conf/unix/sqlline/sqlline.py
index 852f264..8027443 100644
--- a/ambari-metrics-timelineservice/conf/unix/sqlline/sqlline.py
+++ b/ambari-metrics-timelineservice/conf/unix/sqlline/sqlline.py
@@ -20,7 +20,7 @@
############################################################################
import os
-import subprocess
+from ambari_commons import subprocess32
import sys
import phoenix_utils
import atexit
@@ -95,7 +95,7 @@
print 'java command: %s' % str(java_cmd)
-childProc = subprocess.Popen(java_cmd, shell=True)
+childProc = subprocess32.Popen(java_cmd, shell=True)
#Wait for child process exit
(output, error) = childProc.communicate()
returncode = childProc.returncode
diff --git a/ambari-metrics-timelineservice/src/main/python/embedded_hbase_service.py b/ambari-metrics-timelineservice/src/main/python/embedded_hbase_service.py
index 7667d7d..2040959 100644
--- a/ambari-metrics-timelineservice/src/main/python/embedded_hbase_service.py
+++ b/ambari-metrics-timelineservice/src/main/python/embedded_hbase_service.py
@@ -82,7 +82,7 @@
def Install(cls, startupMode = "auto", username = None, password = None):
print "Installing service %s" % (cls._svc_name_)
- # Configure master.xml, which drives the java subprocess
+ # Configure master.xml, which drives the java subprocess32
java_path = get_java_exe_path()
java_args = _build_master_java_args(username)
diff --git a/ambari-metrics-timelineservice/src/main/python/main.py b/ambari-metrics-timelineservice/src/main/python/main.py
index b6b4e0b..7a5f87a 100644
--- a/ambari-metrics-timelineservice/src/main/python/main.py
+++ b/ambari-metrics-timelineservice/src/main/python/main.py
@@ -19,7 +19,7 @@
'''
import os
-import subprocess
+from ambari_commons import subprocess32
import sys
from ambari_commons.exceptions import FatalException, NonFatalException
@@ -70,7 +70,7 @@
ams_env_cmd = os.path.join(options.conf_dir, AMS_ENV_CMD)
if os.path.exists(ams_env_cmd):
cmds = ["cmd.exe", "/C", ams_env_cmd]
- procAms = subprocess.Popen(cmds, env=os.environ)
+ procAms = subprocess32.Popen(cmds, env=os.environ)
out, err = procAms.communicate()
if err is not None and err is not "":
print_warning_msg(AMS_ENV_CMD + " error output: " + err)
@@ -129,7 +129,7 @@
param_list = java_exe + " " + command
print_info_msg("Running server: " + str(param_list))
- procJava = subprocess.Popen(param_list, env=os.environ)
+ procJava = subprocess32.Popen(param_list, env=os.environ)
#wait for server process for SERVER_START_TIMEOUT seconds
print "Waiting for server start..."
diff --git a/pom.xml b/pom.xml
index a14b8fd..2982e61 100644
--- a/pom.xml
+++ b/pom.xml
@@ -272,7 +272,7 @@
<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
- <version>0.11</version>
+ <version>0.12</version>
<configuration>
<excludes>
<exclude>pass.txt</exclude>