You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by vanzin <gi...@git.apache.org> on 2015/04/25 01:50:03 UTC

[GitHub] spark pull request: [SPARK-3090] [core] Stop SparkContext if user ...

GitHub user vanzin opened a pull request:

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

    [SPARK-3090] [core] Stop SparkContext if user forgets to.

    Set up a shutdown hook to try to stop the Spark context in
    case the user forgets to do it. The main effect is that any
    open logs files are flushed and closed, which is particularly
    interesting for event logs.

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

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

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

    https://github.com/apache/spark/pull/5696.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 #5696
    
----
commit 3b554b5a89d9f2de213e7bb7632921d87a93d3e7
Author: Marcelo Vanzin <va...@cloudera.com>
Date:   2015-04-24T23:47:56Z

    [SPARK-3090] [core] Stop SparkContext if user forgets to.
    
    Set up a shutdown hook to try to stop the Spark context in
    case the user forgets to do it. The main effect is that any
    open logs files are flushed and closed, which is particularly
    interesting for event logs.

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-3090] [core] Stop SparkContext if user ...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on the pull request:

    https://github.com/apache/spark/pull/5696#issuecomment-96102941
  
    Note that as is this will cause an exception if the hook actually runs; #5672 has a change that fixes that.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-3090] [core] Stop SparkContext if user ...

Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/5696#discussion_r29095078
  
    --- Diff: yarn/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala ---
    @@ -95,14 +95,8 @@ private[spark] class ApplicationMaster(
     
           val fs = FileSystem.get(yarnConf)
     
    -      Utils.addShutdownHook { () =>
    -        // If the SparkContext is still registered, shut it down as a best case effort in case
    -        // users do not call sc.stop or do System.exit().
    -        val sc = sparkContextRef.get()
    -        if (sc != null) {
    -          logInfo("Invoking sc stop from shutdown hook")
    -          sc.stop()
    -        }
    +      // This shutdown hook should run *after* the SparkContext is shut down.
    +      Utils.addShutdownHook(Utils.SPARK_CONTEXT_SHUTDOWN_PRIORITY - 1) { () =>
    --- End diff --
    
    On the grounds that the YARN AM already tries to do this, I think this is probably a good change to implement for all modes. I think it's all too common that user programs exit without calling `stop()` and this does affect things like finding logs.
    
    Calling `stop()` is idempotent right? so the extra hook shouldn't hurt anything even for well-behaved programs.
    
    You have some spurious white-space changes in this PR. Not really worth fixing but might tell your IDE not to change trailing whitespace.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-3090] [core] Stop SparkContext if user ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/5696#issuecomment-96104378
  
      [Test build #30948 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/30948/consoleFull) for   PR 5696 at commit [`3b554b5`](https://github.com/apache/spark/commit/3b554b5a89d9f2de213e7bb7632921d87a93d3e7).


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-3090] [core] Stop SparkContext if user ...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/5696#discussion_r29095193
  
    --- Diff: yarn/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala ---
    @@ -95,14 +95,8 @@ private[spark] class ApplicationMaster(
     
           val fs = FileSystem.get(yarnConf)
     
    -      Utils.addShutdownHook { () =>
    -        // If the SparkContext is still registered, shut it down as a best case effort in case
    -        // users do not call sc.stop or do System.exit().
    -        val sc = sparkContextRef.get()
    -        if (sc != null) {
    -          logInfo("Invoking sc stop from shutdown hook")
    -          sc.stop()
    -        }
    +      // This shutdown hook should run *after* the SparkContext is shut down.
    +      Utils.addShutdownHook(Utils.SPARK_CONTEXT_SHUTDOWN_PRIORITY - 1) { () =>
    --- End diff --
    
    > Calling stop() is idempotent right?
    
    Correct.
    
    > You have some spurious white-space changes in this PR.
    
    IIRC that's in the style guide (not adding trailing whitespace) and we're really, really bad at enforcing that.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-3090] [core] Stop SparkContext if user ...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

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


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-3090] [core] Stop SparkContext if user ...

Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on the pull request:

    https://github.com/apache/spark/pull/5696#issuecomment-96195518
  
    LGTM. I dislike the proliferation of shutdown hooks but we have a better centralized system for it now, and this one is fairly important. Let me leave it for comments for a couple days though.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-3090] [core] Stop SparkContext if user ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/5696#issuecomment-96121428
  
      [Test build #30948 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/30948/consoleFull) for   PR 5696 at commit [`3b554b5`](https://github.com/apache/spark/commit/3b554b5a89d9f2de213e7bb7632921d87a93d3e7).
     * This patch **passes all tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.
     * This patch **adds the following new dependencies:**
       * `tachyon-0.6.4.jar`
       * `tachyon-client-0.6.4.jar`
    
     * This patch **removes the following dependencies:**
       * `tachyon-0.5.0.jar`
       * `tachyon-client-0.5.0.jar`



---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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