How to restart the Spark session within the notebook without reattaching the notebook?

chandan_a_v
Valued Contributor

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