PHOENIX-1770 Correct exit code from bin scripts Make the python scripts under bin/ exit with the exit code that was returned from the underlying java command.
Contributed by Mark Tse. Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/4d716100 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/4d716100 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/4d716100 Branch: refs/heads/4.x-HBase-1.x Commit: 4d71610081903a535767f1a462ba47e1ffec5191 Parents: 6cb6a37 Author: Gabriel Reid <[email protected]> Authored: Thu Mar 26 08:43:48 2015 +0100 Committer: Gabriel Reid <[email protected]> Committed: Thu Mar 26 08:47:15 2015 +0100 ---------------------------------------------------------------------- bin/end2endTest.py | 3 ++- bin/performance.py | 13 ++++++++++--- bin/psql.py | 3 ++- 3 files changed, 14 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/4d716100/bin/end2endTest.py ---------------------------------------------------------------------- diff --git a/bin/end2endTest.py b/bin/end2endTest.py index 96886c7..a5993dc 100755 --- a/bin/end2endTest.py +++ b/bin/end2endTest.py @@ -44,4 +44,5 @@ java_cmd = "java -cp " + hbase_config_path + os.pathsep + phoenix_jar_path + os. hbase_library_path + " org.apache.phoenix.end2end.End2EndTestDriver " + \ ' '.join(sys.argv[1:]) -subprocess.call(java_cmd, shell=True) +exitcode = subprocess.call(java_cmd, shell=True) +sys.exit(exitcode) http://git-wip-us.apache.org/repos/asf/phoenix/blob/4d716100/bin/performance.py ---------------------------------------------------------------------- diff --git a/bin/performance.py b/bin/performance.py index c69edfd..b9df433 100755 --- a/bin/performance.py +++ b/bin/performance.py @@ -85,7 +85,9 @@ print "-----------------------------------------" print "\nCreating performance table..." createFileWithContent(ddl, createtable) -subprocess.call(execute + ddl, shell=True) +exitcode = subprocess.call(execute + ddl, shell=True) +if exitcode != 0: + sys.exit(exitcode) # Write real,user,sys time on console for the following queries queryex("1 - Count", "SELECT COUNT(1) FROM %s;" % (table)) @@ -95,11 +97,16 @@ queryex("4 - Truncate + Group By", "SELECT TRUNC(DATE,'DAY') DAY FROM %s GROUP B queryex("5 - Filter + Count", "SELECT COUNT(1) FROM %s WHERE CORE<10;" % (table)) print "\nGenerating and upserting data..." -subprocess.call('java -jar %s %s' % (phoenix_utils.testjar, rowcount), shell=True) +exitcode = subprocess.call('java -jar %s %s' % (phoenix_utils.testjar, rowcount), shell=True) +if exitcode != 0: + sys.exit(exitcode) + print "\n" createFileWithContent(qry, statements) -subprocess.call(execute + data + ' ' + qry, shell=True) +exitcode = subprocess.call(execute + data + ' ' + qry, shell=True) +if exitcode != 0: + sys.exit(exitcode) # clear temporary files delfile(ddl) http://git-wip-us.apache.org/repos/asf/phoenix/blob/4d716100/bin/psql.py ---------------------------------------------------------------------- diff --git a/bin/psql.py b/bin/psql.py index 34a95df..247001a 100755 --- a/bin/psql.py +++ b/bin/psql.py @@ -39,4 +39,5 @@ java_cmd = 'java -cp "' + phoenix_utils.hbase_conf_path + os.pathsep + phoenix_u os.path.join(phoenix_utils.current_dir, "log4j.properties") + \ " org.apache.phoenix.util.PhoenixRuntime " + args -subprocess.call(java_cmd, shell=True) +exitcode = subprocess.call(java_cmd, shell=True) +sys.exit(exitcode)
