Skip to content
Snippets Groups Projects
  • Matthew Farrellee's avatar
    25b5b867
    [SPARK-3458] enable python "with" statements for SparkContext · 25b5b867
    Matthew Farrellee authored
    allow for best practice code,
    
    ```
    try:
      sc = SparkContext()
      app(sc)
    finally:
      sc.stop()
    ```
    
    to be written using a "with" statement,
    
    ```
    with SparkContext() as sc:
      app(sc)
    ```
    
    Author: Matthew Farrellee <matt@redhat.com>
    
    Closes #2335 from mattf/SPARK-3458 and squashes the following commits:
    
    5b4e37c [Matthew Farrellee] [SPARK-3458] enable python "with" statements for SparkContext
    25b5b867
    History
    [SPARK-3458] enable python "with" statements for SparkContext
    Matthew Farrellee authored
    allow for best practice code,
    
    ```
    try:
      sc = SparkContext()
      app(sc)
    finally:
      sc.stop()
    ```
    
    to be written using a "with" statement,
    
    ```
    with SparkContext() as sc:
      app(sc)
    ```
    
    Author: Matthew Farrellee <matt@redhat.com>
    
    Closes #2335 from mattf/SPARK-3458 and squashes the following commits:
    
    5b4e37c [Matthew Farrellee] [SPARK-3458] enable python "with" statements for SparkContext
context.py 35.06 KiB