anirudh2290 commented on a change in pull request #9681: Better Exception 
Handling for Operators
URL: https://github.com/apache/incubator-mxnet/pull/9681#discussion_r165774551
 
 

 ##########
 File path: src/engine/threaded_engine.h
 ##########
 @@ -338,33 +346,46 @@ class ThreadedEngine : public Engine {
 #endif
     CallbackOnComplete callback = this->CreateCallback(
         ThreadedEngine::OnCompleteStatic, opr_block);
+    CallbackOnComplete on_start_callback = this->CreateCallback(
+        ThreadedEngine::OnStartStatic, opr_block);
     bool debug_info = (engine_info_ && debug_push_opr_ == opr_block);
     if (debug_info) {
       LOG(INFO) << "ExecuteOprBlock " << opr_block
                 << "shutdown_phase=" << shutdown_phase_;
     }
     if (!shutdown_phase_) {
       try {
+        on_start_callback();
         if (debug_info) {
           LOG(INFO) << "ExecuteOprFn ";
         }
-        threaded_opr->fn(run_ctx, callback);
+        try {
+          if (!threaded_opr->ex_ptr || threaded_opr->wait) {
+            threaded_opr->fn(run_ctx, callback);
+          } else {
+            callback();
+          }
+        } catch (dmlc::Error& e) {
 
 Review comment:
   The reason I catch only dmlc::Error is that The guards in the c_api 
API_BEGIN and API_END/API_END_HANDLE_ERROR only catch dmlc::Error currently and 
propagate to frontend. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services

Reply via email to