Matthew Farrellee created SPARK-3458:
----------------------------------------

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


best practice for managing SparkContexts involves exception handling, e.g.

```
try:
  sc = SparkContext()
  app(sc)
finally:
  sc.stop()
```

python provides the "with" statement to simplify this code, e.g.

```
with SparkContext() as sc:
  app(sc)
```

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-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to