You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Reynold Xin (JIRA)" <ji...@apache.org> on 2014/09/10 03:55:30 UTC

[jira] [Resolved] (SPARK-3458) enable use of python's "with" statements for SparkContext management

     [ https://issues.apache.org/jira/browse/SPARK-3458?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Reynold Xin resolved SPARK-3458.
--------------------------------
       Resolution: Fixed
    Fix Version/s: 1.2.0

> enable use of python's "with" statements for SparkContext management
> --------------------------------------------------------------------
>
>                 Key: SPARK-3458
>                 URL: https://issues.apache.org/jira/browse/SPARK-3458
>             Project: Spark
>          Issue Type: New Feature
>          Components: PySpark
>            Reporter: Matthew Farrellee
>            Assignee: Matthew Farrellee
>              Labels: features, python, sparkcontext
>             Fix For: 1.2.0
>
>
> best practice for managing SparkContexts involves exception handling, e.g.
> {code}
> try:
>   sc = SparkContext()
>   app(sc)
> finally:
>   sc.stop()
> {code}
> python provides the "with" statement to simplify this code, e.g.
> {code}
> with SparkContext() as sc:
>   app(sc)
> {code}
> the SparkContext should be usable in a "with" statement



--
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