phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [3/4] phoenix git commit: Add environment variables to control the location of the queryserver .log, .out, and .pid file. Also update the name of all files to '${USER}-queryserver'.
Date Wed, 11 May 2016 02:22:27 GMT
Add environment variables to control the location of the queryserver .log, .out, and .pid file.
Also update the name of all files to '${USER}-queryserver'.

Signed-off-by: Josh Elser <elserj@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/06aca0f2
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/06aca0f2
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/06aca0f2

Branch: refs/heads/4.x-HBase-1.0
Commit: 06aca0f2c5928bbcb479b91af479793fde81a774
Parents: 4ca06a3
Author: Rob Leidle <leidle@amazon.com>
Authored: Mon May 2 13:40:32 2016 -0700
Committer: Josh Elser <elserj@apache.org>
Committed: Tue May 10 22:21:03 2016 -0400

----------------------------------------------------------------------
 bin/queryserver.py | 34 +++++++++++++---------------------
 1 file changed, 13 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/06aca0f2/bin/queryserver.py
----------------------------------------------------------------------
diff --git a/bin/queryserver.py b/bin/queryserver.py
index c80e629..57ca371 100755
--- a/bin/queryserver.py
+++ b/bin/queryserver.py
@@ -74,15 +74,11 @@ else:
 hbase_config_path = phoenix_utils.hbase_conf_dir
 hadoop_config_path = phoenix_utils.hadoop_conf
 
-# default paths ## TODO: add windows support
-java_home = os.getenv('JAVA_HOME')
-hbase_pid_dir = os.path.join(tempfile.gettempdir(), 'phoenix')
-phoenix_log_dir = os.path.join(tempfile.gettempdir(), 'phoenix')
-phoenix_file_basename = 'phoenix-%s-server' % getpass.getuser()
+# TODO: add windows support
+phoenix_file_basename = '%s-queryserver' % getpass.getuser()
 phoenix_log_file = '%s.log' % phoenix_file_basename
 phoenix_out_file = '%s.out' % phoenix_file_basename
 phoenix_pid_file = '%s.pid' % phoenix_file_basename
-opts = os.getenv('PHOENIX_QUERYSERVER_OPTS', '')
 
 # load hbase-env.??? to extract JAVA_HOME, HBASE_PID_DIR, HBASE_LOG_DIR
 hbase_env_path = None
@@ -104,24 +100,20 @@ if os.path.isfile(hbase_env_path):
         (k, _, v) = x.partition('=')
         hbase_env[k.strip()] = v.strip()
 
-if hbase_env.has_key('JAVA_HOME'):
-    java_home = hbase_env['JAVA_HOME']
-if hbase_env.has_key('HBASE_PID_DIR'):
-    hbase_pid_dir = hbase_env['HBASE_PID_DIR']
-if hbase_env.has_key('HBASE_LOG_DIR'):
-    phoenix_log_dir = hbase_env['HBASE_LOG_DIR']
-if hbase_env.has_key('PHOENIX_QUERYSERVER_OPTS'):
-    opts = hbase_env['PHOENIX_QUERYSERVER_OPTS']
-
-log_file_path = os.path.join(phoenix_log_dir, phoenix_log_file)
-out_file_path = os.path.join(phoenix_log_dir, phoenix_out_file)
-pid_file_path = os.path.join(hbase_pid_dir, phoenix_pid_file)
-
+java_home = hbase_env.get('JAVA_HOME') or os.getenv('JAVA_HOME')
 if java_home:
     java = os.path.join(java_home, 'bin', 'java')
 else:
     java = 'java'
 
+tmp_dir = os.path.join(tempfile.gettempdir(), 'phoenix')
+opts = os.getenv('PHOENIX_QUERYSERVER_OPTS') or hbase_env.get('PHOENIX_QUERYSERVER_OPTS')
or ''
+pid_dir = os.getenv('PHOENIX_QUERYSERVER_PID_DIR') or hbase_env.get('HBASE_PID_DIR') or tmp_dir
+log_dir = os.getenv('PHOENIX_QUERYSERVER_LOG_DIR') or hbase_env.get('HBASE_LOG_DIR') or tmp_dir
+pid_file_path = os.path.join(pid_dir, phoenix_pid_file)
+log_file_path = os.path.join(log_dir, phoenix_log_file)
+out_file_path = os.path.join(log_dir, phoenix_out_file)
+
 #    " -Xdebug -Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=n " + \
 #    " -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:FlightRecorderOptions=defaultrecording=true,dumponexit=true"
+ \
 
@@ -137,7 +129,7 @@ java_cmd = '%(java)s -cp ' + hbase_config_path + os.pathsep + hadoop_config_path
     " org.apache.phoenix.queryserver.server.Main " + args
 
 if command == 'makeWinServiceDesc':
-    cmd = java_cmd % {'java': java, 'root_logger': 'INFO,DRFA,console', 'log_dir': phoenix_log_dir,
'log_file': phoenix_log_file}
+    cmd = java_cmd % {'java': java, 'root_logger': 'INFO,DRFA,console', 'log_dir': log_dir,
'log_file': phoenix_log_file}
     slices = cmd.split(' ')
 
     print "<service>"
@@ -168,7 +160,7 @@ if command == 'start':
         with context:
             # this block is the main() for the forked daemon process
             child = None
-            cmd = java_cmd % {'java': java, 'root_logger': 'INFO,DRFA', 'log_dir': phoenix_log_dir,
'log_file': phoenix_log_file}
+            cmd = java_cmd % {'java': java, 'root_logger': 'INFO,DRFA', 'log_dir': log_dir,
'log_file': phoenix_log_file}
 
             # notify the child when we're killed
             def handler(signum, frame):


Mime
View raw message