How to restart the Spark session within the notebook without reattaching the notebook?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2022 05:22 AM
Hi All,
I want to run an ETL pipeline in a sequential way in my DB notebook. If I run it without resetting the Spark session or restarting the cluster I am getting a data frame key error. I think this might be because of the Spark cache because If I restart the cluster and run the next item of the sequence I don't get this issue. I am clearing the Spark cache at the end of the ETL pipeline for each run but still, I am facing the same issue. I thought stopping the Spark session and starting it again will fix this, but that will reattach the notebook. And execution starts from the beginning not from the next item in the sequence.
Thanks,
Chandan
- Labels:
-
Notebook
-
Sparksession
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2022 04:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2023 01:32 AM
Is there a solution to the above problem? I also would like to restart SparkSession to free my cluster's resources, but when calling
spark.stop()
the notebook automatically detach and the following error occurs:
The spark context has stopped and the driver is restarting. Your notebook will be automatically reattached.
Is there a recommended way to restart SparkSession?

