Github user andrewor14 commented on the pull request:

    https://github.com/apache/spark/pull/3121#issuecomment-62080029
  
    Hey @JoshRosen regarding the problem of not knowing whether the creation of 
a SparkContext has thrown an exception, can we do something like the following:
    
    ```
    class SparkContext(...) {
      ...
      // Whether this context is constructed successfully
      var isConstructed = false
    
      // Check whether there is already an active context
      // If not, set this context as the active context. Otherwise, abort.
      SparkContext.setActiveContext(this)
    
      // The rest of SparkContext
      ...
      isConstructed = true
    }
    ```
    
    Then we can tell whether construction was successful. If it wasn't, then we 
could clean up the state through a new `sc.cleanup` or something that looks 
like `sc.stop`, except with extra care that each of the components created 
could be null because they haven't been instantiated yet.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to