You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@madlib.apache.org by nk...@apache.org on 2021/02/18 19:37:49 UTC

[madlib] 01/02: DL: Replace e.args[0] with e.message

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

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

commit 80842c99155e453d4377aa867e9b56763acbd8ca
Author: Ekta Khanna <ek...@vmware.com>
AuthorDate: Wed Feb 17 13:31:56 2021 -0800

    DL: Replace e.args[0] with e.message
    
    JIRA: MADLIB-1467
    
    Previously we were relying on e.args[0] in our except block but some of the
    exceptions raised by tensorflow like `InvalidArgumentError` do not have e.args
    as empty. This is not usual but there is no guarantee of args being populated
    so we should instead rely on e.message(typically e.args[0] is the same as
    e.message)
    
    Co-authored-by: Ekta Khanna<ek...@vmware.com>
---
 src/ports/postgres/modules/deep_learning/madlib_keras.sql_in      | 8 ++++----
 .../modules/deep_learning/madlib_keras_fit_multiple_model.sql_in  | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/ports/postgres/modules/deep_learning/madlib_keras.sql_in b/src/ports/postgres/modules/deep_learning/madlib_keras.sql_in
index da61e8e..2620706 100644
--- a/src/ports/postgres/modules/deep_learning/madlib_keras.sql_in
+++ b/src/ports/postgres/modules/deep_learning/madlib_keras.sql_in
@@ -1691,7 +1691,7 @@ PythonFunctionBodyOnlyNoSchema(`deep_learning', `madlib_keras')
     except Exception as e:
         etype, _, tb = exc_info()
         detail = ''.join(traceback.format_exception(etype, e, tb))
-        message = e.args[0] + 'TransAggDetail' + detail
+        message = e.message + 'TransAggDetail' + detail
         e.args = (message,)
         raise e
 $$ LANGUAGE plpythonu
@@ -1733,7 +1733,7 @@ PythonFunctionBodyOnlyNoSchema(`deep_learning', `madlib_keras')
     except Exception as e:
         etype, _, tb = exc_info()
         detail = ''.join(traceback.format_exception(etype, e, tb))
-        message = e.args[0] + 'TransAggDetail' + detail
+        message = e.message + 'TransAggDetail' + detail
         e.args = (message,)
         raise e
 $$ LANGUAGE plpythonu
@@ -1753,7 +1753,7 @@ PythonFunctionBodyOnlyNoSchema(`deep_learning', `madlib_keras')
     except Exception as e:
         etype, _, tb = exc_info()
         detail = ''.join(traceback.format_exception(etype, e, tb))
-        message = e.args[0] + 'MergeAggDetail' + detail
+        message = e.message + 'MergeAggDetail' + detail
         e.args = (message,)
         raise e
 $$ LANGUAGE plpythonu
@@ -1771,7 +1771,7 @@ PythonFunctionBodyOnlyNoSchema(`deep_learning', `madlib_keras')
     except Exception as e:
         etype, _, tb = exc_info()
         detail = ''.join(traceback.format_exception(etype, e, tb))
-        message = e.args[0] + 'FinalAggDetail' + detail
+        message = e.message + 'FinalAggDetail' + detail
         e.args = (message,)
         raise e
 
diff --git a/src/ports/postgres/modules/deep_learning/madlib_keras_fit_multiple_model.sql_in b/src/ports/postgres/modules/deep_learning/madlib_keras_fit_multiple_model.sql_in
index 42fd7d9..84e4426 100644
--- a/src/ports/postgres/modules/deep_learning/madlib_keras_fit_multiple_model.sql_in
+++ b/src/ports/postgres/modules/deep_learning/madlib_keras_fit_multiple_model.sql_in
@@ -1539,7 +1539,7 @@ PythonFunctionBodyOnlyNoSchema(`deep_learning', `madlib_keras')
     except Exception as e:
         etype, _, tb = exc_info()
         detail = ''.join(traceback.format_exception(etype, e, tb))
-        message = e.args[0] + '\nTransAggDetail:\n' + detail
+        message = e.message + '\nTransAggDetail:\n' + detail
         e.args = (message,)
         raise e
 $$ LANGUAGE plpythonu