Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-3458

enable use of python's "with" statements for SparkContext management

    XMLWordPrintableJSON

Details

    Description

      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

      Attachments

        Issue Links

          Activity

            People

              farrellee Matthew Farrellee
              farrellee Matthew Farrellee
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: