You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@madlib.apache.org by ok...@apache.org on 2018/07/24 18:22:00 UTC
madlib git commit: Madpack: Fix various schema related bugs and
messages.
Repository: madlib
Updated Branches:
refs/heads/master 0f7834e9e -> 1fe308c70
Madpack: Fix various schema related bugs and messages.
Closes #297
Project: http://git-wip-us.apache.org/repos/asf/madlib/repo
Commit: http://git-wip-us.apache.org/repos/asf/madlib/commit/1fe308c7
Tree: http://git-wip-us.apache.org/repos/asf/madlib/tree/1fe308c7
Diff: http://git-wip-us.apache.org/repos/asf/madlib/diff/1fe308c7
Branch: refs/heads/master
Commit: 1fe308c70d2c91fef508d29d81ed0e93da429eb6
Parents: 0f7834e
Author: Orhan Kislal <ok...@pivotal.io>
Authored: Tue Jul 24 11:20:18 2018 -0700
Committer: Orhan Kislal <ok...@pivotal.io>
Committed: Tue Jul 24 11:20:18 2018 -0700
----------------------------------------------------------------------
src/madpack/madpack.py | 34 ++++++++++++++++++----------------
1 file changed, 18 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/madlib/blob/1fe308c7/src/madpack/madpack.py
----------------------------------------------------------------------
diff --git a/src/madpack/madpack.py b/src/madpack/madpack.py
index ee5dbbf..23cffa0 100755
--- a/src/madpack/madpack.py
+++ b/src/madpack/madpack.py
@@ -712,6 +712,7 @@ def _process_py_sql_files_in_modules(modset, args_dict):
cur_tmpdir)
else:
error_(this, "Something is wrong, shouldn't be here: %s" % src_file, True)
+ shutil.rmtree(cur_tmpdir)
# ------------------------------------------------------------------------------
def _execute_per_module_db_create_obj_algo(schema, maddir_mod_py, module,
@@ -911,7 +912,7 @@ def parse_arguments():
This will run all the unit tests that are defined in the convex module, and
for decision trees in the recursive partitioning module.
The -t option runs tests only for required modules, and can be used similarly
- for both install-check and dev-check.
+ for install-check, dev-check and unit-test.
""")
help_msg = """One of the following options:
@@ -965,11 +966,11 @@ def parse_arguments():
# Get the arguments
return parser.parse_args()
-def _is_madlib_installation_valid_for_tests(schema, db_madlib_ver):
+def _is_madlib_installation_valid_for_tests(schema, db_madlib_ver, test_type):
# Compare OS and DB versions. Continue if OS = DB.
if get_rev_num(db_madlib_ver) != get_rev_num(new_madlib_ver):
_print_vers(new_madlib_ver, db_madlib_ver, con_args, schema)
- info_(this, "Versions do not match. Unit-test stopped.", True)
+ info_(this, "Versions do not match. {0} stopped.".format(test_type.capitalize()), True)
return False
return True
@@ -995,7 +996,8 @@ def run_unit_tests(args, testcase):
Run unit tests.
"""
if not _is_madlib_installation_valid_for_tests(args['schema'],
- args['db_madlib_ver']):
+ args['db_madlib_ver'],
+ 'unit-tests'):
return
info_(this, "> Running unit-test scripts for:", verbose)
modset = _get_modset_for_tests(testcase, 'test_')
@@ -1007,7 +1009,7 @@ def run_install_check(args, testcase, madpack_cmd):
is_install_check = True if madpack_cmd == 'install-check' else False
schema = args['schema']
db_madlib_ver = args['db_madlib_ver']
- if not _is_madlib_installation_valid_for_tests(schema, db_madlib_ver):
+ if not _is_madlib_installation_valid_for_tests(schema, db_madlib_ver, madpack_cmd):
return
# Create install-check user
db_name = args["c_db"].replace('.', '').replace('-', '_')
@@ -1165,14 +1167,15 @@ def create_install_madlib_sqlfile(args, madpack_cmd):
return_signal += 1
# 2) Compare OS and DB versions. Continue if OS > DB.
- _print_vers(new_madlib_ver, db_madlib_ver, con_args, schema)
- if is_rev_gte(get_rev_num(db_madlib_ver), get_rev_num(new_madlib_ver)):
- info_(this, "Current MADlib version is already up-to-date.", True)
- return_signal += 1
-
- # 3) Run upgrade
- _plpy_check(py_min_ver)
- return_signal = _db_upgrade(schema, output_filehandle, db_madlib_ver)
+ else:
+ _print_vers(new_madlib_ver, db_madlib_ver, con_args, schema)
+ if is_rev_gte(get_rev_num(db_madlib_ver), get_rev_num(new_madlib_ver)):
+ info_(this, "Current MADlib version is already up-to-date.", True)
+ return_signal += 1
+ else:
+ # 3) Run upgrade
+ _plpy_check(py_min_ver)
+ return_signal = _db_upgrade(schema, output_filehandle, db_madlib_ver)
return 1 if return_signal > 0 else 0
@@ -1340,15 +1343,14 @@ def main(argv):
error_(this, "Unknown problem with database connection string: %s" % con_args, True)
# ---------------- Completed "Get and validate arguments" -----------------
- # COMMAND: version
- if args.command[0] == 'version':
- _print_vers(new_madlib_ver, db_madlib_ver, con_args, schema)
# COMMAND: install-check, dev-check or unit-test
if args.command[0] in ('install-check', 'dev-check'):
run_install_check(locals(), args.testcase, args.command[0])
elif args.command[0] == 'unit-test':
run_unit_tests(locals(), args.testcase)
+ elif args.command[0] == 'version':
+ _print_vers(new_madlib_ver, db_madlib_ver, con_args, schema)
else:
if args.testcase:
error_(this,