GitHub user tdas opened a pull request:
https://github.com/apache/spark/pull/6070
[SPARK-7553] [STREAMING] Added methods to maintain a singleton
StreamingContext
In a REPL/notebook environment, its very easy to lose a reference to a
StreamingContext by overriding the variable name. So if you happen to execute
the following commands
```
val ssc = new StreamingContext(...) // cmd 1
ssc.start() // cmd 2
...
val ssc = new StreamingContext(...) // accidentally run cmd 1 again
```
The value of ssc will be overwritten. Now you can neither start the new
context (as only one context can be started), nor stop the previous context (as
the reference is lost).
Hence its best to maintain a singleton reference to the active context, so
that we never loose reference for the active context.
Since this problem occurs useful in REPL environments, its best to add this
as an Experimental support in the Scala API only so that it can be used in
Scala REPLs and notebooks.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/tdas/spark SPARK-7553
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/6070.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 #6070
----
commit d37a846d1fd6af6607e5697c69ceb1ede1e76eee
Author: Tathagata Das <[email protected]>
Date: 2015-05-12T02:55:07Z
Added getActive and getActiveOrCreate
----
---
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]