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 2021/12/08 00:04:36 UTC

[madlib] branch master updated (ac0c46d -> a2311d9)

This is an automated email from the ASF dual-hosted git repository.

okislal pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/madlib.git.


    from ac0c46d  @orhankislal WCC: Optimize subtx count and catalog entry frequency (#573)
     new 95b3643  Revert "Build: Fix module pathname for gppkg"
     new a2311d9  Build: Use dynamic_library_path for module pathname

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 deploy/gppkg/gppkg_spec.yml.in                     |  3 --
 deploy/gppkg/madlib.spec.in                        |  2 -
 src/madpack/changelist_1.18.0_1.19.0-dev.yaml      |  6 ++-
 src/madpack/madpack.py                             | 63 ++++++++++++++++++----
 src/ports/postgres/extension/madlib.control_in     |  2 +-
 .../deep_learning/test/madlib_keras_automl.sql_in  |  6 +--
 .../test/madlib_keras_custom_function.sql_in       |  6 +--
 .../test/madlib_keras_evaluate.sql_in              |  6 +--
 .../deep_learning/test/madlib_keras_fit.sql_in     | 14 ++---
 .../test/madlib_keras_fit_multiple.sql_in          |  7 ++-
 .../test/madlib_keras_model_averaging_e2e.sql_in   | 13 +++--
 .../test/madlib_keras_model_selection.sql_in       | 12 ++---
 .../test/madlib_keras_model_selection_e2e.sql_in   | 13 +++--
 .../test/madlib_keras_multi_io.sql_in              | 13 +++--
 .../deep_learning/test/madlib_keras_predict.sql_in | 13 +++--
 .../test/madlib_keras_predict_byom.sql_in          |  7 ++-
 .../test/madlib_keras_transfer_learning.sql_in     | 13 +++--
 tool/jenkins/jenkins_build.sh                      |  4 +-
 18 files changed, 118 insertions(+), 85 deletions(-)

[madlib] 01/02: Revert "Build: Fix module pathname for gppkg"

Posted by ok...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

okislal pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/madlib.git

commit 95b3643f087e357dd9d3cbb3083dd543101159f2
Author: Orhan Kislal <ok...@apache.org>
AuthorDate: Fri Nov 5 17:54:55 2021 -0400

    Revert "Build: Fix module pathname for gppkg"
    
    This reverts commit e1337aec283e3bcfb9de0a6f950f780664fa9940.
    
    The reverted commit was creating a symlink for the lilbmadlib.so file.
    Since we decided to use the dynamic_library_path GUC, this link is
    and the associated changes are not needed any more.
---
 deploy/gppkg/gppkg_spec.yml.in                |  3 --
 deploy/gppkg/madlib.spec.in                   |  2 --
 src/madpack/changelist_1.18.0_1.19.0-dev.yaml | 50 ---------------------------
 src/madpack/madpack.py                        | 12 +------
 4 files changed, 1 insertion(+), 66 deletions(-)

diff --git a/deploy/gppkg/gppkg_spec.yml.in b/deploy/gppkg/gppkg_spec.yml.in
index 8be15b4..474fda0 100644
--- a/deploy/gppkg/gppkg_spec.yml.in
+++ b/deploy/gppkg/gppkg_spec.yml.in
@@ -17,6 +17,3 @@ PostInstall:
            echo 'For additional options run:';
            echo '$ madpack --help';
            echo 'Release notes and additional documentation can be found at http://madlib.apache.org';"
-PostUninstall:
-- Master: "rm $GPHOME/lib/postgresql/libmadlib.so"
-- Segment: "rm $GPHOME/lib/postgresql/libmadlib.so"
diff --git a/deploy/gppkg/madlib.spec.in b/deploy/gppkg/madlib.spec.in
index c2ca316..78fdb90 100644
--- a/deploy/gppkg/madlib.spec.in
+++ b/deploy/gppkg/madlib.spec.in
@@ -54,8 +54,6 @@ ln -nsf $RPM_INSTALL_PREFIX/madlib/Versions/$MADLIB_VERSION $RPM_INSTALL_PREFIX/
 ln -nsf $RPM_INSTALL_PREFIX/madlib/Current/bin $RPM_INSTALL_PREFIX/madlib/bin
 ln -nsf $RPM_INSTALL_PREFIX/madlib/Current/doc $RPM_INSTALL_PREFIX/madlib/doc
 
-ln -nsf $RPM_INSTALL_PREFIX/madlib/Current/ports/greenplum/@GPDB_VERSION@/lib/libmadlib.so $RPM_INSTALL_PREFIX/lib/postgresql/libmadlib.so
-
 # creating symlink for madpack (does not work at present)
 # find $RPM_INSTALL_PREFIX/bin/madpack -type f -exec mv {} $RPM_INSTALL_PREFIX/bin/old_madpack \; 2>/dev/null
 # ln -nsf $RPM_INSTALL_PREFIX/madlib/Current/bin/madpack $RPM_INSTALL_PREFIX/bin/madpack
diff --git a/src/madpack/changelist_1.18.0_1.19.0-dev.yaml b/src/madpack/changelist_1.18.0_1.19.0-dev.yaml
deleted file mode 100644
index c1aad8d..0000000
--- a/src/madpack/changelist_1.18.0_1.19.0-dev.yaml
+++ /dev/null
@@ -1,50 +0,0 @@
-# ------------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-# ------------------------------------------------------------------------------
-
-# Changelist for MADlib version rel/v1.15 to rel/v1.15.1
-
-# This file contains all changes that were introduced in a new version of
-# MADlib. This changelist is used by the upgrade script to detect what objects
-# should be upgraded (while retaining all other objects from the previous version)
-
-# New modules (actually .sql_in files) added in upgrade version
-# For these files the sql_in code is retained as is with the functions in the
-# file installed on the upgrade version. All other files (that don't have
-# updates), are cleaned up to remove object replacements
-new module:
-
-# Changes in the types (UDT) including removal and modification
-udt:
-
-# List of the UDF changes that affect the user externally. This includes change
-# in function name, return type, argument order or types, or removal of
-# the function. In each case, the original function is as good as removed and a
-# new function is created. In such cases, we should abort the upgrade if there
-# are user views dependent on this function, since the original function will
-# not be present in the upgraded version.
-udf:
-
-# Changes to aggregates (UDA) including removal and modification
-# Overloaded functions should be mentioned separately
-uda:
-
-# List of the UDC, UDO and UDOC changes.
-udc:
-udo:
-udoc:
diff --git a/src/madpack/madpack.py b/src/madpack/madpack.py
index e29e0cf..f620a68 100755
--- a/src/madpack/madpack.py
+++ b/src/madpack/madpack.py
@@ -1232,13 +1232,6 @@ def get_madlib_function_drop_str(schema):
     for idx in range(len(madlib_functions)):
 
         func = madlib_functions[idx]
-
-        # Filter out the DEFAULT value from the function arguments
-        # DROP FUNCTION statements do not need or allow default values:
-        # DROP FUNCTION foo(bar INTEGER DEFAULT 0);
-        func['args'] = func['args'].split(',')
-        func['args'] = [i.split('DEFAULT')[0] for i in func['args']]
-        func['args'] = ', '.join(func['args'])
         # We don't drop type related functions
         no_drop = ['bytea8', 'float8arr', 'svec']
         if not any(x in func['name'] for x in no_drop):
@@ -1410,10 +1403,7 @@ def main(argv):
             maddir_conf = maddir + "/config"
 
         global maddir_lib
-        if portid == 'greenplum' and \
-           os.path.islink(maddir + "/../../../lib/postgresql/libmadlib.so"):
-           maddir_lib = '$libdir/libmadlib.so'
-        elif os.path.isfile(maddir + "/ports/" + portid + "/" + dbver +
+        if os.path.isfile(maddir + "/ports/" + portid + "/" + dbver +
                           "/lib/libmadlib.so"):
             maddir_lib = maddir + "/ports/" + portid + "/" + dbver + \
                 "/lib/libmadlib.so"

[madlib] 02/02: Build: Use dynamic_library_path for module pathname

Posted by ok...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

okislal pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/madlib.git

commit a2311d9288ddc74dcbf8850fff6120d53bea17cd
Author: Orhan Kislal <ok...@apache.org>
AuthorDate: Fri Nov 5 18:48:55 2021 -0400

    Build: Use dynamic_library_path for module pathname
    
    MADlib used to hard code the path for the module_pathname.
    This has been changed to accomodate for major version upgrades of
    Postgres and Greenplum. However, some systems do not play well
    with symlinks, so we revert that change and use the
    dynamic_library_path GUC to find the .so file instead.
---
 src/madpack/changelist_1.18.0_1.19.0-dev.yaml      | 54 +++++++++++++++++
 src/madpack/madpack.py                             | 67 +++++++++++++++++++---
 src/ports/postgres/extension/madlib.control_in     |  2 +-
 .../deep_learning/test/madlib_keras_automl.sql_in  |  6 +-
 .../test/madlib_keras_custom_function.sql_in       |  6 +-
 .../test/madlib_keras_evaluate.sql_in              |  6 +-
 .../deep_learning/test/madlib_keras_fit.sql_in     | 14 ++---
 .../test/madlib_keras_fit_multiple.sql_in          |  7 +--
 .../test/madlib_keras_model_averaging_e2e.sql_in   | 13 ++---
 .../test/madlib_keras_model_selection.sql_in       | 12 ++--
 .../test/madlib_keras_model_selection_e2e.sql_in   | 13 ++---
 .../test/madlib_keras_multi_io.sql_in              | 13 ++---
 .../deep_learning/test/madlib_keras_predict.sql_in | 13 ++---
 .../test/madlib_keras_predict_byom.sql_in          |  7 +--
 .../test/madlib_keras_transfer_learning.sql_in     | 13 ++---
 tool/jenkins/jenkins_build.sh                      |  4 +-
 16 files changed, 174 insertions(+), 76 deletions(-)

diff --git a/src/madpack/changelist_1.18.0_1.19.0-dev.yaml b/src/madpack/changelist_1.18.0_1.19.0-dev.yaml
new file mode 100644
index 0000000..c027836
--- /dev/null
+++ b/src/madpack/changelist_1.18.0_1.19.0-dev.yaml
@@ -0,0 +1,54 @@
+# ------------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ------------------------------------------------------------------------------
+
+# Changelist for MADlib version rel/v1.18.0 to 1.19.0-dev
+
+# This file contains all changes that were introduced in a new version of
+# MADlib. This changelist is used by the upgrade script to detect what objects
+# should be upgraded (while retaining all other objects from the previous version)
+
+# New modules (actually .sql_in files) added in upgrade version
+# For these files the sql_in code is retained as is with the functions in the
+# file installed on the upgrade version. All other files (that don't have
+# updates), are cleaned up to remove object replacements
+new module:
+
+# Changes in the types (UDT) including removal and modification
+udt:
+
+# List of the UDF changes that affect the user externally. This includes change
+# in function name, return type, argument order or types, or removal of
+# the function. In each case, the original function is as good as removed and a
+# new function is created. In such cases, we should abort the upgrade if there
+# are user views dependent on this function, since the original function will
+# not be present in the upgraded version.
+udf:
+
+# Changes to aggregates (UDA) including removal and modification
+# Overloaded functions should be mentioned separately
+uda:
+
+# List of the UDC, UDO and UDOC changes.
+udc:
+
+# Changes in the operators (UDO)
+udo:
+
+# Changes in the operator classes (UDOC)
+udoc:
diff --git a/src/madpack/madpack.py b/src/madpack/madpack.py
index f620a68..9380715 100755
--- a/src/madpack/madpack.py
+++ b/src/madpack/madpack.py
@@ -50,7 +50,7 @@ this = os.path.basename(sys.argv[0])    # name of this script
 
 # Default directories
 maddir_conf = maddir + "/config"           # Config dir
-maddir_lib = maddir + "/lib/libmadlib.so"  # C/C++ libraries
+maddir_lib = "libmadlib.so"  # C/C++ libraries
 
 # Read the config files
 ports = configyml.get_ports(maddir_conf)  # object made of Ports.yml
@@ -179,6 +179,7 @@ def _run_m4_and_append(schema, maddir_mod_py, module, sqlfile,
                   '-DPLPYTHON_LIBDIR=' + maddir_mod_py,
                   '-DEXT_PYTHON_LIBDIR=' + maddir_ext_py,
                   '-DMODULE_PATHNAME=' + maddir_lib,
+                  '-DMADLIB_LIBRARY_PATH=' + madlib_library_path,
                   '-DMODULE_NAME=' + module,
                   '-I' + maddir_madpack,
                   sqlfile]
@@ -848,6 +849,13 @@ def _db_create_objects(schema, create_obj_handle, upgrade=False, sc=None):
         error_(this, "Cannot insert data into %s.migrationhistory table" % schema, False)
         raise Exception
 
+    try:
+        _write_to_file(create_obj_handle,
+                       """SET dynamic_library_path = '%s';
+                       """ % (dynamic_library_path))
+    except:
+        error_(this, "Cannot set dynamic_library_path to %s" % dynamic_library_path, False)
+        raise Exception
     # Run migration SQLs
     info_(this, "> Preparing objects for the following modules:", True)
     # We always create objects for all modules during install/reinstall/upgrade
@@ -1232,6 +1240,14 @@ def get_madlib_function_drop_str(schema):
     for idx in range(len(madlib_functions)):
 
         func = madlib_functions[idx]
+
+        # Filter out the DEFAULT value from the function arguments
+        # DROP FUNCTION statements do not need or allow default values:
+        # DROP FUNCTION foo(bar INTEGER DEFAULT 0);
+        func['args'] = func['args'].split(',')
+        func['args'] = [i.split('DEFAULT')[0] for i in func['args']]
+        func['args'] = ', '.join(func['args'])
+
         # We don't drop type related functions
         no_drop = ['bytea8', 'float8arr', 'svec']
         if not any(x in func['name'] for x in no_drop):
@@ -1267,6 +1283,45 @@ def get_madlib_operator_drop_str(schema):
             schema, i['name'], i['left_op'], i['right_op'])
     return drop_str
 
+def find_madlib_library_path():
+
+    # Local build at ~/workspace/madlib/build/
+    if os.path.isfile(maddir + "/../src/ports/" + portid + "/" + dbver +
+                      "/lib/libmadlib.so"):
+        madlib_library_path = maddir + "/../src/ports/" + portid + "/" + dbver + \
+            "/lib"
+
+    # Package build at /usr/local/madlib/Versions or $GPHOME/madlib/Versions
+    elif os.path.isfile(maddir + "/../../Current/ports/" + portid + "/" + dbver +
+                      "/lib/libmadlib.so"):
+        madlib_library_path = maddir + "/../../Current/ports/" + portid + "/" + dbver + \
+            "/lib"
+    else:
+        madlib_library_path = maddir + "/lib"
+
+    return madlib_library_path
+
+def set_dynamic_library_path_in_database(dbver_split, madlib_library_path):
+
+    global dynamic_library_path
+    dynamic_library_path = _internal_run_query("SHOW dynamic_library_path", True)[0]['dynamic_library_path']
+
+    if madlib_library_path not in dynamic_library_path.split(":"):
+        dynamic_library_path = dynamic_library_path + ':' + madlib_library_path
+
+        if portid == 'greenplum':
+            if is_rev_gte(dbver_split, get_rev_num('6.0')):
+                os.system('gpconfig -c dynamic_library_path -v \'{0}\''.format(dynamic_library_path))
+            else:
+                os.system('gpconfig -c dynamic_library_path -v \'\\{0}\''.format(dynamic_library_path))
+            os.system('gpstop -u')
+        else:
+            _internal_run_query(
+                "ALTER SYSTEM SET dynamic_library_path TO '{0}'".format(dynamic_library_path), True)
+            pg_data_directory = _internal_run_query("SHOW data_directory", True)[0]['data_directory']
+            os.system('pg_ctl -D {0} reload'.format(pg_data_directory))
+
+
 def main(argv):
     args = parse_arguments()
 
@@ -1402,13 +1457,9 @@ def main(argv):
         else:
             maddir_conf = maddir + "/config"
 
-        global maddir_lib
-        if os.path.isfile(maddir + "/ports/" + portid + "/" + dbver +
-                          "/lib/libmadlib.so"):
-            maddir_lib = maddir + "/ports/" + portid + "/" + dbver + \
-                "/lib/libmadlib.so"
-        else:
-            maddir_lib = maddir + "/lib/libmadlib.so"
+        global madlib_library_path
+        madlib_library_path = find_madlib_library_path()
+        set_dynamic_library_path_in_database(dbver_split, madlib_library_path)
 
         # Get the list of modules for this port
         global portspecs
diff --git a/src/ports/postgres/extension/madlib.control_in b/src/ports/postgres/extension/madlib.control_in
index 2059515..ba0027f 100644
--- a/src/ports/postgres/extension/madlib.control_in
+++ b/src/ports/postgres/extension/madlib.control_in
@@ -1,5 +1,5 @@
 default_version = '@MADLIB_VERSION_MAJOR@.@MADLIB_VERSION_MINOR@.@MADLIB_VERSION_PATCH@'
 comment = 'A scalable in-database analytics library'
 relocatable = false
-module_pathname = '$libdir/libmadlib.so'
+module_pathname = 'libmadlib.so'
 requires = 'plpythonu'
diff --git a/src/ports/postgres/modules/deep_learning/test/madlib_keras_automl.sql_in b/src/ports/postgres/modules/deep_learning/test/madlib_keras_automl.sql_in
index 6448ac8..c8a85a4 100644
--- a/src/ports/postgres/modules/deep_learning/test/madlib_keras_automl.sql_in
+++ b/src/ports/postgres/modules/deep_learning/test/madlib_keras_automl.sql_in
@@ -21,9 +21,9 @@
 
 m4_include(`SQLCommon.m4')
 
-\i m4_regexp(MODULE_PATHNAME,
-             `\(.*\)libmadlib\.so',
-              `\1../../modules/deep_learning/test/madlib_keras_iris.setup.sql_in'
+\i m4_regexp(MADLIB_LIBRARY_PATH,
+             `\(.*\)/lib',
+              `\1/../modules/deep_learning/test/madlib_keras_iris.setup.sql_in'
 )
 
 m4_changequote(`<!', `!>')
diff --git a/src/ports/postgres/modules/deep_learning/test/madlib_keras_custom_function.sql_in b/src/ports/postgres/modules/deep_learning/test/madlib_keras_custom_function.sql_in
index a08f818..5e26ac9 100644
--- a/src/ports/postgres/modules/deep_learning/test/madlib_keras_custom_function.sql_in
+++ b/src/ports/postgres/modules/deep_learning/test/madlib_keras_custom_function.sql_in
@@ -25,9 +25,9 @@
 
 m4_include(`SQLCommon.m4')
 
-\i m4_regexp(MODULE_PATHNAME,
-             `\(.*\)libmadlib\.so',
-             `\1../../modules/deep_learning/test/madlib_keras_custom_function.setup.sql_in'
+\i m4_regexp(MADLIB_LIBRARY_PATH,
+             `\(.*\)/lib',
+              `\1/../modules/deep_learning/test/madlib_keras_custom_function.setup.sql_in'
 )
 
 /* Test successful table creation where no table exists */
diff --git a/src/ports/postgres/modules/deep_learning/test/madlib_keras_evaluate.sql_in b/src/ports/postgres/modules/deep_learning/test/madlib_keras_evaluate.sql_in
index 167153c..6b6669c 100644
--- a/src/ports/postgres/modules/deep_learning/test/madlib_keras_evaluate.sql_in
+++ b/src/ports/postgres/modules/deep_learning/test/madlib_keras_evaluate.sql_in
@@ -21,9 +21,9 @@
 
 m4_include(`SQLCommon.m4')
 
-\i m4_regexp(MODULE_PATHNAME,
-             `\(.*\)libmadlib\.so',
-             `\1../../modules/deep_learning/test/madlib_keras_cifar.setup.sql_in'
+\i m4_regexp(MADLIB_LIBRARY_PATH,
+             `\(.*\)/lib',
+              `\1/../modules/deep_learning/test/madlib_keras_cifar.setup.sql_in'
 )
 
 -- -- Please do not break up the compile_params string
diff --git a/src/ports/postgres/modules/deep_learning/test/madlib_keras_fit.sql_in b/src/ports/postgres/modules/deep_learning/test/madlib_keras_fit.sql_in
index c816b1d..ed52ce7 100644
--- a/src/ports/postgres/modules/deep_learning/test/madlib_keras_fit.sql_in
+++ b/src/ports/postgres/modules/deep_learning/test/madlib_keras_fit.sql_in
@@ -19,16 +19,16 @@
  *
  *//* ---------------------------------------------------------------------*/
 
-\i m4_regexp(MODULE_PATHNAME,
-             `\(.*\)libmadlib\.so',
-             `\1../../modules/deep_learning/test/madlib_keras_cifar.setup.sql_in'
+\i m4_regexp(MADLIB_LIBRARY_PATH,
+             `\(.*\)/lib',
+              `\1/../modules/deep_learning/test/madlib_keras_cifar.setup.sql_in'
 )
 
-\i m4_regexp(MODULE_PATHNAME,
-             `\(.*\)libmadlib\.so',
-             `\1../../modules/deep_learning/test/madlib_keras_iris.setup.sql_in'
-)
 
+\i m4_regexp(MADLIB_LIBRARY_PATH,
+             `\(.*\)/lib',
+              `\1/../modules/deep_learning/test/madlib_keras_iris.setup.sql_in'
+)
 m4_include(`SQLCommon.m4')
 SELECT assert(test_output_table($test$SELECT madlib_keras_fit(
     'cifar_10_sample_batched',
diff --git a/src/ports/postgres/modules/deep_learning/test/madlib_keras_fit_multiple.sql_in b/src/ports/postgres/modules/deep_learning/test/madlib_keras_fit_multiple.sql_in
index 7e5448b..07c4325 100644
--- a/src/ports/postgres/modules/deep_learning/test/madlib_keras_fit_multiple.sql_in
+++ b/src/ports/postgres/modules/deep_learning/test/madlib_keras_fit_multiple.sql_in
@@ -41,11 +41,10 @@ m4_changequote(<!,!>)
 --  the model hopping behavior will be for a large cluster, even though dev-check should be
 --  able to run on a single dev host.
 
-\i m4_regexp(MODULE_PATHNAME,
-             <!\(.*\)libmadlib\.so!>,
-            <!\1../../modules/deep_learning/test/madlib_keras_iris.setup.sql_in!>
+\i m4_regexp(MADLIB_LIBRARY_PATH,
+             <!\(.*\)/lib!>,
+             <!\1/../modules/deep_learning/test/madlib_keras_iris.setup.sql_in!>
 )
-
 -- Mock version() function to convince the InputValidator this is the real madlib schema
 CREATE OR REPLACE FUNCTION madlib_installcheck_deep_learning.version() RETURNS VARCHAR AS
 $$
diff --git a/src/ports/postgres/modules/deep_learning/test/madlib_keras_model_averaging_e2e.sql_in b/src/ports/postgres/modules/deep_learning/test/madlib_keras_model_averaging_e2e.sql_in
index 67ffa0e..0961c05 100644
--- a/src/ports/postgres/modules/deep_learning/test/madlib_keras_model_averaging_e2e.sql_in
+++ b/src/ports/postgres/modules/deep_learning/test/madlib_keras_model_averaging_e2e.sql_in
@@ -21,14 +21,13 @@
 
 m4_include(`SQLCommon.m4')
 
-\i m4_regexp(MODULE_PATHNAME,
-             `\(.*\)libmadlib\.so',
-             `\1../../modules/deep_learning/test/madlib_keras_iris.setup.sql_in'
+\i m4_regexp(MADLIB_LIBRARY_PATH,
+             `\(.*\)/lib',
+              `\1/../modules/deep_learning/test/madlib_keras_iris.setup.sql_in'
 )
-
-\i m4_regexp(MODULE_PATHNAME,
-             `\(.*\)libmadlib\.so',
-             `\1../../modules/deep_learning/test/madlib_keras_custom_function.setup.sql_in'
+\i m4_regexp(MADLIB_LIBRARY_PATH,
+             `\(.*\)/lib',
+              `\1/../modules/deep_learning/test/madlib_keras_custom_function.setup.sql_in'
 )
 
 DROP TABLE if exists pg_temp.iris_model, pg_temp.iris_model_summary;
diff --git a/src/ports/postgres/modules/deep_learning/test/madlib_keras_model_selection.sql_in b/src/ports/postgres/modules/deep_learning/test/madlib_keras_model_selection.sql_in
index 2946184..485d64a 100644
--- a/src/ports/postgres/modules/deep_learning/test/madlib_keras_model_selection.sql_in
+++ b/src/ports/postgres/modules/deep_learning/test/madlib_keras_model_selection.sql_in
@@ -21,14 +21,14 @@
 
 m4_include(`SQLCommon.m4')
 
-\i m4_regexp(MODULE_PATHNAME,
-             `\(.*\)libmadlib\.so',
-              `\1../../modules/deep_learning/test/madlib_keras_iris.setup.sql_in'
+\i m4_regexp(MADLIB_LIBRARY_PATH,
+             `\(.*\)/lib',
+              `\1/../modules/deep_learning/test/madlib_keras_iris.setup.sql_in'
 )
 
-\i m4_regexp(MODULE_PATHNAME,
-             `\(.*\)libmadlib\.so',
-              `\1../../modules/deep_learning/test/madlib_keras_custom_function.setup.sql_in'
+\i m4_regexp(MADLIB_LIBRARY_PATH,
+             `\(.*\)/lib',
+              `\1/../modules/deep_learning/test/madlib_keras_custom_function.setup.sql_in'
 )
 
 ------------------------------------------------------------------------------------------------------
diff --git a/src/ports/postgres/modules/deep_learning/test/madlib_keras_model_selection_e2e.sql_in b/src/ports/postgres/modules/deep_learning/test/madlib_keras_model_selection_e2e.sql_in
index 1ef692f..14b13ed 100644
--- a/src/ports/postgres/modules/deep_learning/test/madlib_keras_model_selection_e2e.sql_in
+++ b/src/ports/postgres/modules/deep_learning/test/madlib_keras_model_selection_e2e.sql_in
@@ -21,14 +21,13 @@
 
 m4_include(`SQLCommon.m4')
 
-\i m4_regexp(MODULE_PATHNAME,
-             `\(.*\)libmadlib\.so',
-             `\1../../modules/deep_learning/test/madlib_keras_iris.setup.sql_in'
+\i m4_regexp(MADLIB_LIBRARY_PATH,
+             `\(.*\)/lib',
+              `\1/../modules/deep_learning/test/madlib_keras_iris.setup.sql_in'
 )
-
-\i m4_regexp(MODULE_PATHNAME,
-             `\(.*\)libmadlib\.so',
-             `\1../../modules/deep_learning/test/madlib_keras_custom_function.setup.sql_in'
+\i m4_regexp(MADLIB_LIBRARY_PATH,
+             `\(.*\)/lib',
+              `\1/../modules/deep_learning/test/madlib_keras_custom_function.setup.sql_in'
 )
 
 m4_changequote(`<!', `!>')
diff --git a/src/ports/postgres/modules/deep_learning/test/madlib_keras_multi_io.sql_in b/src/ports/postgres/modules/deep_learning/test/madlib_keras_multi_io.sql_in
index 0c00851..f6b6a07 100644
--- a/src/ports/postgres/modules/deep_learning/test/madlib_keras_multi_io.sql_in
+++ b/src/ports/postgres/modules/deep_learning/test/madlib_keras_multi_io.sql_in
@@ -19,14 +19,13 @@
  *
  *//* ---------------------------------------------------------------------*/
 
-\i m4_regexp(MODULE_PATHNAME,
-             `\(.*\)libmadlib\.so',
-             `\1../../modules/deep_learning/test/madlib_keras_iris.setup.sql_in'
+\i m4_regexp(MADLIB_LIBRARY_PATH,
+             `\(.*\)/lib',
+              `\1/../modules/deep_learning/test/madlib_keras_iris.setup.sql_in'
 )
-
-\i m4_regexp(MODULE_PATHNAME,
-             `\(.*\)libmadlib\.so',
-             `\1../../modules/deep_learning/test/madlib_keras_custom_function.setup.sql_in'
+\i m4_regexp(MADLIB_LIBRARY_PATH,
+             `\(.*\)/lib',
+              `\1/../modules/deep_learning/test/madlib_keras_custom_function.setup.sql_in'
 )
 
 m4_include(`SQLCommon.m4')
diff --git a/src/ports/postgres/modules/deep_learning/test/madlib_keras_predict.sql_in b/src/ports/postgres/modules/deep_learning/test/madlib_keras_predict.sql_in
index 9994739..9f19dce 100644
--- a/src/ports/postgres/modules/deep_learning/test/madlib_keras_predict.sql_in
+++ b/src/ports/postgres/modules/deep_learning/test/madlib_keras_predict.sql_in
@@ -21,9 +21,9 @@
 
 m4_include(`SQLCommon.m4')
 
-\i m4_regexp(MODULE_PATHNAME,
-             `\(.*\)libmadlib\.so',
-             `\1../../modules/deep_learning/test/madlib_keras_cifar.setup.sql_in'
+\i m4_regexp(MADLIB_LIBRARY_PATH,
+             `\(.*\)/lib',
+              `\1/../modules/deep_learning/test/madlib_keras_cifar.setup.sql_in'
 )
 
 -- Please do not break up the compile_params string
@@ -337,11 +337,10 @@ SELECT madlib_keras_predict(
 
 -- Test multi model
 
-\i m4_regexp(MODULE_PATHNAME,
-             `\(.*\)libmadlib\.so',
-             `\1../../modules/deep_learning/test/madlib_keras_iris.setup.sql_in'
+\i m4_regexp(MADLIB_LIBRARY_PATH,
+             `\(.*\)/lib',
+              `\1/../modules/deep_learning/test/madlib_keras_iris.setup.sql_in'
 )
-
 m4_changequote(`<!', `!>')
 m4_ifdef(<!__POSTGRESQL__!>, <!!>, <!
 
diff --git a/src/ports/postgres/modules/deep_learning/test/madlib_keras_predict_byom.sql_in b/src/ports/postgres/modules/deep_learning/test/madlib_keras_predict_byom.sql_in
index 6f258cd..9dc9d08 100644
--- a/src/ports/postgres/modules/deep_learning/test/madlib_keras_predict_byom.sql_in
+++ b/src/ports/postgres/modules/deep_learning/test/madlib_keras_predict_byom.sql_in
@@ -19,11 +19,10 @@
  *
  *//* ---------------------------------------------------------------------*/
 
-\i m4_regexp(MODULE_PATHNAME,
-             `\(.*\)libmadlib\.so',
-             `\1../../modules/deep_learning/test/madlib_keras_iris.setup.sql_in'
+\i m4_regexp(MADLIB_LIBRARY_PATH,
+             `\(.*\)/lib',
+              `\1/../modules/deep_learning/test/madlib_keras_iris.setup.sql_in'
 )
-
 DROP TABLE IF EXISTS iris_model, iris_model_summary;
 SELECT madlib_keras_fit('iris_data_packed',   -- source table
                         'iris_model',          -- model output table
diff --git a/src/ports/postgres/modules/deep_learning/test/madlib_keras_transfer_learning.sql_in b/src/ports/postgres/modules/deep_learning/test/madlib_keras_transfer_learning.sql_in
index 1689d52..125588c 100644
--- a/src/ports/postgres/modules/deep_learning/test/madlib_keras_transfer_learning.sql_in
+++ b/src/ports/postgres/modules/deep_learning/test/madlib_keras_transfer_learning.sql_in
@@ -21,9 +21,9 @@
 
 m4_include(`SQLCommon.m4')
 
-\i m4_regexp(MODULE_PATHNAME,
-             `\(.*\)libmadlib\.so',
-             `\1../../modules/deep_learning/test/madlib_keras_iris.setup.sql_in'
+\i m4_regexp(MADLIB_LIBRARY_PATH,
+             `\(.*\)/lib',
+              `\1/../modules/deep_learning/test/madlib_keras_iris.setup.sql_in'
 )
 -------------- Warm start test (along with schema qualified output table) -------------------------
 CREATE SCHEMA __MADLIB__DEEP_LEARNING_SCHEMA__MADLIB__;
@@ -125,11 +125,10 @@ FROM iris_model_first_run AS first,
 iris_model_transfer_summary AS second;
 
 -- Rerun the iris setup to discard the changes
-\i m4_regexp(MODULE_PATHNAME,
-             `\(.*\)libmadlib\.so',
-             `\1../../modules/deep_learning/test/madlib_keras_iris.setup.sql_in'
+\i m4_regexp(MADLIB_LIBRARY_PATH,
+             `\(.*\)/lib',
+              `\1/../modules/deep_learning/test/madlib_keras_iris.setup.sql_in'
 )
-
 m4_changequote(`<!', `!>')
 m4_ifdef(<!__POSTGRESQL__!>, <!!>, <!
 
diff --git a/tool/jenkins/jenkins_build.sh b/tool/jenkins/jenkins_build.sh
index 560bcd6..721ec43 100755
--- a/tool/jenkins/jenkins_build.sh
+++ b/tool/jenkins/jenkins_build.sh
@@ -74,9 +74,9 @@ docker exec madlib bash -c 'rm -rf /build; mkdir /build; cd /build; cmake ../mad
 echo "---------- Installing and running dev-check --------------------"
 # Install MADlib and run dev check
 cat <<EOF
-docker exec madlib bash -c '/build/src/bin/madpack -s mad -p postgres -c postgres/postgres@localhost:5432/postgres install' | tee $workdir/logs/madlib_install.log
+docker exec madlib bash -u postgres -c '/build/src/bin/madpack -s mad -p postgres -c postgres/postgres@localhost:5432/postgres install' | tee $workdir/logs/madlib_install.log
 EOF
-docker exec madlib bash -c '/build/src/bin/madpack -s mad -p postgres -c postgres/postgres@localhost:5432/postgres install' | tee $workdir/logs/madlib_install.log
+docker exec madlib bash -u postgres -c '/build/src/bin/madpack -s mad -p postgres -c postgres/postgres@localhost:5432/postgres install' | tee $workdir/logs/madlib_install.log
 
 cat <<EOF
 docker exec madlib bash -c 'mkdir -p /tmp'