reductionista commented on a change in pull request #525:
URL: https://github.com/apache/madlib/pull/525#discussion_r537809115



##########
File path: src/ports/postgres/modules/deep_learning/madlib_keras.sql_in
##########
@@ -1793,13 +1793,23 @@ CREATE OR REPLACE FUNCTION MADLIB_SCHEMA.fit_transition(
     segments_per_host           INTEGER,
     images_per_seg              INTEGER[],
     use_gpus                    BOOLEAN,
-    accessible_gpus_for_seg                INTEGER[],
+    accessible_gpus_for_seg     INTEGER[],
     prev_serialized_weights     BYTEA,
     is_final_iteration          BOOLEAN,
-    custom_function_map        BYTEA
+    custom_function_map         BYTEA
 ) RETURNS BYTEA AS $$
 PythonFunctionBodyOnlyNoSchema(`deep_learning', `madlib_keras')
-    return madlib_keras.fit_transition(**globals())
+    import traceback
+    from sys import exc_info
+    import plpy
+    try:
+        return madlib_keras.fit_transition(**globals())
+    except Exception as e:
+        etype, _, tb = exc_info()
+        detail = ''.join(traceback.format_exception(etype, e, tb))
+        message = e.args[0] + 'TransAggDetail' + detail

Review comment:
       Good point.
   
     Originally I was thinking I would make a simple general mechanism for 
doing this for any python function running on the segments that we're calling 
from another python function on master with `plpy.execute()`.  But the story 
had already had gotten long enough that I ended up just leaving it kind of 
hacked together, with duplicated code reused in both fit and fit multiple.
   
     Eventually, I think we should move it into `utilities` somewhere, but I 
haven't thought it through much.  Come to think of it, maybe I should move this 
over into `utilities/debug.py` and have it as a part of that PR instead of this 
one? 
    It could be enabled with a flag passed to plpy_execute() I guess.  Or maybe 
even just automatically enabled for that function, since it shouldn't affect 
anything if the `TransAggDetail` (or whatever keyword we choose) doesn't come 
back with the exception.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to