You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@madlib.apache.org by kh...@apache.org on 2020/10/27 20:18:08 UTC

[madlib] 03/08: Add MinWarning to remove extraneous INFO messages

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

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

commit 88f2ebc717562a86e69fb197acfa91e963babb70
Author: Domino Valdano <dv...@vmware.com>
AuthorDate: Mon Sep 28 17:17:16 2020 -0700

    Add MinWarning to remove extraneous INFO messages
    
    JIRA: MADLIB-1453
    
    We might also want to add it to PythonFunction macro, and
    automatically wrap every function call with:
     with MinWarning('warning')
    This is what we do for AOControl, which makes sense to me.  But
    before enabling that we would need to check to make sure nothing
    in MADlib is counting on INFO statements showing up by default.
    For now, I'm just importing it by default so that it can easily
    be used along with AOControl in the .sql_in files.  This is much
    better than putting decorators on all of our functions in the
    .py_in files, as the latter will keep turning this GUC on and
    off every time a function is entered or exited.
---
 src/ports/postgres/madpack/SQLCommon.m4_in                    |  2 +-
 .../postgres/modules/deep_learning/madlib_keras_automl.py_in  | 11 +----------
 .../postgres/modules/deep_learning/madlib_keras_automl.sql_in |  4 ++--
 3 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/src/ports/postgres/madpack/SQLCommon.m4_in b/src/ports/postgres/madpack/SQLCommon.m4_in
index ffc0c37..cc58ea2 100644
--- a/src/ports/postgres/madpack/SQLCommon.m4_in
+++ b/src/ports/postgres/madpack/SQLCommon.m4_in
@@ -82,7 +82,7 @@ m4_define(<!PythonFunctionBodyOnly!>, <!
 
     global schema_madlib
     schema_madlib = rv[0]['nspname']
-    from utilities.control import AOControl
+    from utilities.control import AOControl,MinWarning
 !>)
 
 /*
diff --git a/src/ports/postgres/modules/deep_learning/madlib_keras_automl.py_in b/src/ports/postgres/modules/deep_learning/madlib_keras_automl.py_in
index d6eeba3..0df6772 100644
--- a/src/ports/postgres/modules/deep_learning/madlib_keras_automl.py_in
+++ b/src/ports/postgres/modules/deep_learning/madlib_keras_automl.py_in
@@ -30,7 +30,7 @@ from madlib_keras_validator import MstLoaderInputValidator
 # from utilities.admin import cleanup_madlib_temp_tables
 from utilities.utilities import get_current_timestamp, get_seg_number, get_segments_per_host, \
     unique_string, add_postfix, extract_keyvalue_params, _assert, _assert_equal, rename_table
-from utilities.control import MinWarning, SetGUC
+from utilities.control import SetGUC
 from madlib_keras_fit_multiple_model import FitMultipleModel
 from madlib_keras_helper import generate_row_string
 from madlib_keras_helper import DISTRIBUTION_RULES
@@ -61,7 +61,6 @@ class AutoMLConstants:
     INT_MAX = 2 ** 31 - 1
     TARGET_SCHEMA = 'public'
 
-@MinWarning("warning")
 class HyperbandSchedule():
     """The utility class for loading a hyperband schedule table with algorithm inputs.
 
@@ -171,7 +170,6 @@ class HyperbandSchedule():
                                       **locals())
             plpy.execute(insert_query)
 
-# @MinWarning("warning")
 class KerasAutoML(object):
     """
     The core AutoML class for running AutoML algorithms such as Hyperband and Hyperopt.
@@ -234,7 +232,6 @@ class KerasAutoML(object):
                                      {ModelArchSchema.MODEL_ARCH} JSON)
                                     """.format(self=self, ModelSelectionSchema=ModelSelectionSchema,
                                                ModelArchSchema=ModelArchSchema)
-        # with MinWarning('warning'):
         plpy.execute(output_table_create_query)
 
     def create_model_output_info_table(self):
@@ -329,7 +326,6 @@ class KerasAutoML(object):
                        descr=descr,
                        model_training=model_training))
 
-        # with MinWarning('warning'):
         plpy.execute(create_query)
 
     def is_automl_method(self, method_name):
@@ -389,7 +385,6 @@ class KerasAutoML(object):
                      model_training.model_summary_table, AutoMLConstants.TEMP_MST_TABLE,
                      AutoMLConstants.TEMP_MST_SUMMARY_TABLE])
 
-# @MinWarning("warning")
 class AutoMLHyperband(KerasAutoML):
     """
     This class implements Hyperband, an infinite-arm bandit based algorithm that speeds up random search
@@ -563,7 +558,6 @@ class AutoMLHyperband(KerasAutoML):
                                   model_id=ModelSelectionSchema.MODEL_ID,
                                   compile_params=ModelSelectionSchema.COMPILE_PARAMS,
                                   fit_params=ModelSelectionSchema.FIT_PARAMS)
-        # with MinWarning('warning'):
         plpy.execute(create_query)
 
         query = ""
@@ -667,7 +661,6 @@ class AutoMLHyperband(KerasAutoML):
                 "b (key integer, s_val integer, i_val integer) WHERE t.mst_key=b.key".format(self=self, l=l)
         plpy.execute(query)
 
-# @MinWarning("warning")
 class AutoMLHyperopt(KerasAutoML):
     """
     This class implements Hyperopt, another automl method that explores awkward search spaces using
@@ -1000,7 +993,6 @@ class AutoMLHyperopt(KerasAutoML):
                                   model_id=ModelSelectionSchema.MODEL_ID,
                                   compile_params=ModelSelectionSchema.COMPILE_PARAMS,
                                   fit_params=ModelSelectionSchema.FIT_PARAMS)
-        # with MinWarning('warning'):
         plpy.execute(create_query)
         mst_key_val = i
         for mst in msts_list:
@@ -1051,7 +1043,6 @@ class AutoMLHyperopt(KerasAutoML):
                        """.format(tbl_name=tbl_name,
                                   model_arch_table=ModelSelectionSchema.MODEL_ARCH_TABLE,
                                   object_table=ModelSelectionSchema.OBJECT_TABLE)
-        # with MinWarning('warning'):
         plpy.execute(create_query)
 
         if self.object_table is None:
diff --git a/src/ports/postgres/modules/deep_learning/madlib_keras_automl.sql_in b/src/ports/postgres/modules/deep_learning/madlib_keras_automl.sql_in
index 98617d7..a5c7507 100644
--- a/src/ports/postgres/modules/deep_learning/madlib_keras_automl.sql_in
+++ b/src/ports/postgres/modules/deep_learning/madlib_keras_automl.sql_in
@@ -626,7 +626,7 @@ CREATE OR REPLACE FUNCTION MADLIB_SCHEMA.hyperband_schedule(
       skip_last             INTEGER DEFAULT 0
 ) RETURNS VOID AS $$
     PythonFunctionBodyOnly(`deep_learning', `madlib_keras_automl')
-    with AOControl(False):
+    with AOControl(False) and MinWarning('warning'):
         schedule_loader = madlib_keras_automl.HyperbandSchedule(schedule_table, r, eta, skip_last)
         schedule_loader.load()
 $$ LANGUAGE plpythonu VOLATILE
@@ -651,7 +651,7 @@ CREATE OR REPLACE FUNCTION MADLIB_SCHEMA.madlib_keras_automl(
     description                    VARCHAR DEFAULT NULL
 ) RETURNS VOID AS $$
     PythonFunctionBodyOnly(`deep_learning', `madlib_keras_automl')
-    with AOControl(False):
+    with AOControl(False) and MinWarning('warning'):
         if automl_method is None or automl_method.lower() == 'hyperband':
             schedule_loader = madlib_keras_automl.AutoMLHyperband(**globals())
         elif automl_method.lower() == 'hyperopt':