This is an automated email from the ASF dual-hosted git repository. richardantal pushed a commit to branch 5.1 in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/5.1 by this push: new e6d8f40 PHOENIX-6485 Clean up classpath in .py scripts e6d8f40 is described below commit e6d8f409d15d0dda90651f7a66b8ac59f684d5bd Author: Richard Antal <antal97rich...@gmail.com> AuthorDate: Wed Jun 2 10:34:29 2021 +0200 PHOENIX-6485 Clean up classpath in .py scripts Change-Id: I8d69b3c04b3930e3a155f34ae60672717d257ee3 --- bin/performance.py | 7 ++++--- bin/pherf-standalone.py | 4 ++-- bin/phoenix_utils.py | 19 ------------------- bin/psql.py | 7 ++++--- bin/sqlline.py | 12 +++++------- bin/traceserver.py | 6 +++--- 6 files changed, 18 insertions(+), 37 deletions(-) diff --git a/bin/performance.py b/bin/performance.py index 16fee48..0215806 100755 --- a/bin/performance.py +++ b/bin/performance.py @@ -65,7 +65,7 @@ phoenix_utils.setPath() # HBase configuration folder path (where hbase-site.xml reside) for # HBase/Phoenix client side property override -hbase_config_path = os.getenv('HBASE_CONF_DIR', phoenix_utils.current_dir) +hbase_config_path = phoenix_utils.hbase_conf_dir java_home = os.getenv('JAVA_HOME') @@ -97,10 +97,11 @@ if java_home: else: java_cmd = 'java' -execute = ('%s $PHOENIX_OPTS -cp "%s%s%s" -Dlog4j.configuration=file:' + +execute = ('%s $PHOENIX_OPTS -cp "%s%s%s%s%s" -Dlog4j.configuration=file:' + os.path.join(phoenix_utils.current_dir, "log4j.properties") + ' org.apache.phoenix.util.PhoenixRuntime -t %s %s ') % \ - (java_cmd, hbase_config_path, os.pathsep, phoenix_utils.phoenix_client_jar, table, zookeeper) + (java_cmd, hbase_config_path, os.pathsep, phoenix_utils.slf4j_backend_jar, os.pathsep, + phoenix_utils.phoenix_client_embedded_jar, table, zookeeper) # Create Table DDL createtable = "CREATE TABLE IF NOT EXISTS %s (HOST CHAR(2) NOT NULL,\ diff --git a/bin/pherf-standalone.py b/bin/pherf-standalone.py index b87585e..86d6984 100755 --- a/bin/pherf-standalone.py +++ b/bin/pherf-standalone.py @@ -32,7 +32,7 @@ args = phoenix_utils.shell_quote(sys.argv[1:]) # HBase configuration folder path (where hbase-site.xml reside) for # HBase/Phoenix client side property override -hbase_config_path = os.getenv('HBASE_CONF_DIR', phoenix_utils.current_dir) +hbase_config_path = phoenix_utils.hbase_conf_dir java_home = os.getenv('JAVA_HOME') @@ -64,7 +64,7 @@ if java_home: else: java = 'java' -java_cmd = java +' -Xms512m -Xmx3072m -cp "' + phoenix_utils.pherf_conf_path + os.pathsep + phoenix_utils.hbase_conf_dir + os.pathsep + phoenix_utils.phoenix_client_jar + os.pathsep + phoenix_utils.phoenix_pherf_jar + \ +java_cmd = java +' -Xms512m -Xmx3072m -cp "' + phoenix_utils.pherf_conf_path + os.pathsep + phoenix_utils.hbase_conf_dir + os.pathsep + phoenix_utils.slf4j_backend_jar + os.pathsep + phoenix_utils.phoenix_client_embedded_jar + os.pathsep + phoenix_utils.phoenix_pherf_jar + \ '" -Dlog4j.configuration=file:' + \ os.path.join(phoenix_utils.current_dir, "log4j.properties") + \ " org.apache.phoenix.pherf.Pherf " + args diff --git a/bin/phoenix_utils.py b/bin/phoenix_utils.py index d5cfab6..f58e113 100755 --- a/bin/phoenix_utils.py +++ b/bin/phoenix_utils.py @@ -107,8 +107,6 @@ def setPath(): else: # Try to provide something valid hbase_conf_dir = '.' - global hbase_conf_path # keep conf_path around for backward compatibility - hbase_conf_path = hbase_conf_dir global current_dir current_dir = os.path.dirname(os.path.abspath(__file__)) @@ -149,18 +147,6 @@ def setPath(): else: hadoop_classpath = os.getenv('HADOOP_CLASSPATH', '').rstrip() - global hadoop_common_jar_path - hadoop_common_jar_path = os.path.join(current_dir, "..", "phoenix-client", "target","*").rstrip() - - global hadoop_common_jar - hadoop_common_jar = find("hadoop-common*.jar", hadoop_common_jar_path) - - global hadoop_hdfs_jar_path - hadoop_hdfs_jar_path = os.path.join(current_dir, "..", "phoenix-client", "target","*").rstrip() - - global hadoop_hdfs_jar - hadoop_hdfs_jar = find("hadoop-hdfs*.jar", hadoop_hdfs_jar_path) - global testjar testjar = find(PHOENIX_TESTS_JAR_PATTERN, phoenix_test_jar_path) if testjar == "": @@ -218,15 +204,10 @@ if __name__ == "__main__": setPath() print("phoenix_class_path:", phoenix_class_path) print("hbase_conf_dir:", hbase_conf_dir) - print("hbase_conf_path:", hbase_conf_path) print("current_dir:", current_dir) print("phoenix_embedded_jar_path:", phoenix_embedded_jar_path) print("phoenix_client_embedded_jar:", phoenix_client_embedded_jar) print("phoenix_test_jar_path:", phoenix_test_jar_path) - print("hadoop_common_jar_path:", hadoop_common_jar_path) - print("hadoop_common_jar:", hadoop_common_jar) - print("hadoop_hdfs_jar_path:", hadoop_hdfs_jar_path) - print("hadoop_hdfs_jar:", hadoop_hdfs_jar) print("testjar:", testjar) print("hadoop_classpath:", hadoop_classpath) print("sqlline_with_deps_jar:", sqlline_with_deps_jar) diff --git a/bin/psql.py b/bin/psql.py index 0e57c77..9e2de5a 100755 --- a/bin/psql.py +++ b/bin/psql.py @@ -32,7 +32,7 @@ args = phoenix_utils.shell_quote(sys.argv[1:]) # HBase configuration folder path (where hbase-site.xml reside) for # HBase/Phoenix client side property override -hbase_config_path = os.getenv('HBASE_CONF_DIR', phoenix_utils.current_dir) +hbase_config_path = phoenix_utils.hbase_conf_dir java_home = os.getenv('JAVA_HOME') @@ -65,8 +65,9 @@ else: java = 'java' java_cmd = java + ' $PHOENIX_OPTS ' + \ - ' -cp "' + phoenix_utils.hbase_conf_dir + os.pathsep + phoenix_utils.phoenix_client_jar + \ - os.pathsep + phoenix_utils.hadoop_conf + os.pathsep + phoenix_utils.hadoop_classpath + '" -Dlog4j.configuration=file:' + \ + ' -cp "' + phoenix_utils.hbase_conf_dir + os.pathsep + phoenix_utils.hadoop_conf + \ + os.pathsep + phoenix_utils.slf4j_backend_jar + \ + os.pathsep + phoenix_utils.phoenix_client_embedded_jar + '" -Dlog4j.configuration=file:' + \ os.path.join(phoenix_utils.current_dir, "log4j.properties") + \ " org.apache.phoenix.util.PhoenixRuntime " + args diff --git a/bin/sqlline.py b/bin/sqlline.py index be0637d..3e1d6e9 100755 --- a/bin/sqlline.py +++ b/bin/sqlline.py @@ -63,7 +63,7 @@ sqlfile = tryDecode(args.sqlfile) # HBase configuration folder path (where hbase-site.xml reside) for # HBase/Phoenix client side property override -hbase_config_path = os.getenv('HBASE_CONF_DIR', phoenix_utils.current_dir) +hbase_config_path = phoenix_utils.hbase_conf_dir if sqlfile and not os.path.isfile(sqlfile): parser.print_help() @@ -108,12 +108,10 @@ if os.name == 'nt': colorSetting = "false" java_cmd = java + ' $PHOENIX_OPTS ' + \ - ' -cp "' + phoenix_utils.sqlline_with_deps_jar + os.pathsep + hbase_config_path + os.pathsep + \ - phoenix_utils.slf4j_backend_jar + os.pathsep + \ - phoenix_utils.hbase_conf_dir + os.pathsep + phoenix_utils.phoenix_client_embedded_jar + \ - os.pathsep + phoenix_utils.hadoop_common_jar + os.pathsep + phoenix_utils.hadoop_hdfs_jar + \ - os.pathsep + phoenix_utils.hadoop_conf + os.pathsep + phoenix_utils.hadoop_classpath + '" -Dlog4j.configuration=file:' + \ - os.path.join(phoenix_utils.current_dir, "log4j.properties") + \ + ' -cp "' + phoenix_utils.hbase_conf_dir + os.pathsep + phoenix_utils.hadoop_conf + os.pathsep + \ + phoenix_utils.sqlline_with_deps_jar + os.pathsep + phoenix_utils.slf4j_backend_jar + os.pathsep + \ + phoenix_utils.phoenix_client_embedded_jar + \ + '" -Dlog4j.configuration=file:' + os.path.join(phoenix_utils.current_dir, "log4j.properties") + \ " sqlline.SqlLine -d org.apache.phoenix.jdbc.PhoenixDriver" + \ " -u jdbc:phoenix:" + phoenix_utils.shell_quote([zookeeper]) + \ " -n none -p none --color=" + colorSetting + " --fastConnect=" + tryDecode(args.fastconnect) + \ diff --git a/bin/traceserver.py b/bin/traceserver.py index 35a918c..a2e6f9c 100755 --- a/bin/traceserver.py +++ b/bin/traceserver.py @@ -119,9 +119,9 @@ else: # " -Xdebug -Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=n " + \ # " -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:FlightRecorderOptions=defaultrecording=true,dumponexit=true" + \ java_cmd = '%(java)s ' + \ - '-cp ' + hbase_config_path + os.pathsep + phoenix_utils.phoenix_traceserver_jar + os.pathsep + \ - phoenix_utils.phoenix_client_jar + os.pathsep + phoenix_utils.phoenix_queryserver_jar + \ - os.pathsep + phoenix_utils.hadoop_classpath + \ + '-cp ' + hbase_config_path + os.pathsep + phoenix_utils.hadoop_conf + os.pathsep + \ + phoenix_utils.phoenix_traceserver_jar + os.pathsep + phoenix_utils.slf4j_backend_jar + os.pathsep + \ + phoenix_utils.phoenix_client_embedded_jar + os.pathsep + phoenix_utils.phoenix_queryserver_jar + \ " -Dproc_phoenixtraceserver" + \ " -Dlog4j.configuration=file:" + os.path.join(phoenix_utils.current_dir, "log4j.properties") + \ " -Dpsql.root.logger=%(root_logger)s" + \