[GitHub] spark pull request #18877: [SPARK-17742][core] Handle child process exit in ...

2017-08-15 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/spark/pull/18877


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #18877: [SPARK-17742][core] Handle child process exit in ...

2017-08-10 Thread ash211
Github user ash211 commented on a diff in the pull request:

https://github.com/apache/spark/pull/18877#discussion_r132583520
  
--- Diff: 
launcher/src/main/java/org/apache/spark/launcher/ChildProcAppHandle.java ---
@@ -118,14 +116,40 @@ void setChildProc(Process childProc, String 
loggerName, InputStream logStream) {
 this.childProc = childProc;
 if (logStream != null) {
   this.redirector = new OutputRedirector(logStream, loggerName,
-SparkLauncher.REDIRECTOR_FACTORY);
+SparkLauncher.REDIRECTOR_FACTORY, this);
+} else {
+  // If there is no log redirection, spawn a thread that will wait for 
the child process
+  // to finish.
+  Thread waiter = 
SparkLauncher.REDIRECTOR_FACTORY.newThread(this::monitorChild);
+  waiter.setDaemon(true);
+  waiter.start();
 }
   }
 
   void setConnection(LauncherConnection connection) {
 this.connection = connection;
   }
 
+  /**
+   * Callback for when the child process exits. Forcefully put the 
application in a final state,
+   * overwriting the current final state unless it is already FAILED.
+   */
+  synchronized void childProcessExited() {
+disconnect();
+
+int ec;
+try {
+  ec = childProc.exitValue();
+} catch (Exception e) {
--- End diff --

might want to log the exception here


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #18877: [SPARK-17742][core] Handle child process exit in ...

2017-08-10 Thread ash211
Github user ash211 commented on a diff in the pull request:

https://github.com/apache/spark/pull/18877#discussion_r132583553
  
--- Diff: 
launcher/src/main/java/org/apache/spark/launcher/ChildProcAppHandle.java ---
@@ -166,4 +185,15 @@ private synchronized void fireEvent(boolean 
isInfoChanged) {
 }
   }
 
+  private void monitorChild() {
+while (childProc.isAlive()) {
+  try {
+childProc.waitFor();
+  } catch (Exception e) {
+// Try again.
--- End diff --

log exception here?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #18877: [SPARK-17742][core] Handle child process exit in ...

2017-08-07 Thread vanzin
GitHub user vanzin opened a pull request:

https://github.com/apache/spark/pull/18877

[SPARK-17742][core] Handle child process exit in SparkLauncher.

Currently the launcher handle does not monitor the child spark-submit
process it launches; this means that if the child exits with an error,
the handle's state will never change, and an application will not know
that the application has failed.

This change adds code to monitor the child process, and changes the
handle state appropriately when the child process exits.

Tested with added unit tests.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/vanzin/spark SPARK-17742

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/spark/pull/18877.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #18877


commit 15e1a733dfea38ae09b92d88aeecd5a78de59408
Author: Marcelo Vanzin 
Date:   2017-08-07T22:30:16Z

[SPARK-17742][core] Handle child process exit in SparkLauncher.

Currently the launcher handle does not monitor the child spark-submit
process it launches; this means that if the child exits with an error,
the handle's state will never change, and an application will not know
that the application has failed.

This change adds code to monitor the child process, and changes the
handle state appropriately when the child process exits.

Tested with added unit tests.




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org