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

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


The following commit(s) were added to refs/heads/master by this push:
     new 0715691  [REEF-2063] Propagate exceptions of driver process fail in 
local runtime (#1499)
0715691 is described below

commit 0715691b64b5ab887c14a20db880537f8240da0a
Author: Wooyeon Lee <[email protected]>
AuthorDate: Fri Jun 12 15:51:22 2020 +0900

    [REEF-2063] Propagate exceptions of driver process fail in local runtime 
(#1499)
    
    [REEF-2063] Propagate exceptions of driver process fail in local runtime
    
    Summary of changes:
    - Catch and rethrow exceptions from spawning a driver process for a local 
job (local runtime).
    - As a result, the client process can notice that the job has been failed 
to be submitted.
    
    JIRA:
      [REEF-2063](https://issues.apache.org/jira/projects/REEF/issues/REEF-2063)
    
    Pull Request:
      Closes #1499
---
 .../runtime/local/client/PreparedDriverFolderLauncher.java   | 12 ++++++++++--
 .../apache/reef/runtime/local/process/RunnableProcess.java   |  1 +
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git 
a/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/client/PreparedDriverFolderLauncher.java
 
b/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/client/PreparedDriverFolderLauncher.java
index 141e3aa..dac49dc 100644
--- 
a/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/client/PreparedDriverFolderLauncher.java
+++ 
b/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/client/PreparedDriverFolderLauncher.java
@@ -30,6 +30,7 @@ import javax.inject.Inject;
 import java.io.File;
 import java.util.Collections;
 import java.util.List;
+import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ExecutorService;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -89,8 +90,15 @@ public class PreparedDriverFolderLauncher {
         new LoggingRunnableProcessObserver(),
         stdoutFilePath,
         stderrFilePath);
-    this.executor.submit(process);
-    this.executor.shutdown();
+
+    try {
+      this.executor.submit(process).get();
+    } catch (InterruptedException | ExecutionException e) {
+      LOG.log(Level.SEVERE, "Driver process failed");
+      throw new RuntimeException("Driver process failed", e);
+    } finally {
+      this.executor.shutdown();
+    }
   }
 
   private List<String> makeLaunchCommand() {
diff --git 
a/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/process/RunnableProcess.java
 
b/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/process/RunnableProcess.java
index 0f88a29..290cb0f 100644
--- 
a/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/process/RunnableProcess.java
+++ 
b/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/process/RunnableProcess.java
@@ -200,6 +200,7 @@ public final class RunnableProcess implements Runnable {
 
       } catch (final IOException ex) {
         LOG.log(Level.SEVERE, "Unable to spawn process " + this.id + " with 
command " + this.command, ex);
+        throw new RuntimeException("Unable to spawn process " + this.id + " 
with command " + this.command, ex);
       }
 
     } finally {

Reply via email to