# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: 'Python 3.9.1 64-bit (''my_env'': conda)'
#     language: python
#     name: python391jvsc74a57bd0ab88f8d8cbbcde50b6847df9cf75f0481bc134e870de959eb908027e13484796
# ---

import pyspark
from pyspark.sql import SparkSession

spark = SparkSession.builder.master("local[1]") \
                    .appName('PySparkExampleDemo') \
                    .getOrCreate()
print("First SparkContext:");
print("APP Name :"+spark.sparkContext.appName);
print("Master :"+spark.sparkContext.master);
spark.stop()

spark2 = SparkSession.builder.master("local[1]") \
                          .appName("PySparkExampleDemo2") \
                          .getOrCreate();
print("Second SparkContext:")
print("APP Name :"+spark2.sparkContext.appName);
print("Master :"+spark2.sparkContext.master);
# spark.stop()

spark3 = SparkSession.newSession(spark2)
print("Third SparkContext:")
print("APP Name :"+spark3.sparkContext.appName);
print("Master :"+spark3.sparkContext.master);

StarcoderdataJupyterScriptsDedupFiltered