You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "DAVIDSUNNYKONDRU (JIRA)" <ji...@apache.org> on 2015/11/25 21:27:11 UTC
[jira] [Commented] (SPARK-10426) Cannot call methods on a stopped
SparkContext
[ https://issues.apache.org/jira/browse/SPARK-10426?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15027538#comment-15027538 ]
DAVIDSUNNYKONDRU commented on SPARK-10426:
------------------------------------------
How do we implement the above change?
> Cannot call methods on a stopped SparkContext
> ---------------------------------------------
>
> Key: SPARK-10426
> URL: https://issues.apache.org/jira/browse/SPARK-10426
> Project: Spark
> Issue Type: Improvement
> Components: Spark Core
> Affects Versions: 1.3.1, 1.4.1
> Environment: Spark 1.4.1
> hadoop 2.2.0
> Reporter: cen yuhai
> Priority: Minor
>
> Sometimes, we will see IllegalStateException("Cannot call methods on a stopped SparkContext")
> In methods like parallelize, range, textFile... etc
> It will first call method assertNotStopped() to check whether SparkContext is stopped or not, if stopped throws exception.
> But for users, we do not want to catch IllegalStateException. We want to know the state of SparkContext, maybe a method named isStopped().
> So we can do it like this:
> def getSparkContext(): SparkContext: {
> if(sc == null || sc.isStopped()) {
> sc = new SparkContext()
> }
> }
>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org