Forum Discussion
Can't stop spark session using mssparkutils
I get the following error while trying to stop a spark session in a notebook using: mssparkutils.session.stop()
Does anyone know where the issue may come from ?
Thank you,
Amnay
Hi akanane
Apologies for the issue you have been facing. Currently mssparkutils.session.stop() does not support in Fabric for now. The feature is releasing. We will have to wait until mssparkutils environment utils is ready.
Appreciate your patience.
Hope this helps. Please let us know if you have any further questions. Glad to help.
9 Replies
- v-cboorla-msftMicrosoft Employee
Hi akanane
Thanks for using Microsoft Fabric Community.
Apologies for the issue that you are facing.
As I understand that you are getting an error while trying to stop a spark session in a notebook using: mssparkutils.session.stop().
To resolve this issue, you need to ensure that the JWT (JSON Web Token) is correctly formatted and contains the necessary information for authentication.
Here are a few steps you can take to troubleshoot and fix the issue:
- Check the JWT token: Verify that the JWT token you are using is valid and properly formatted. Make sure it contains all the required parts (header, payload, signature) separated by dots.
- Regenerate the JWT token: If you suspect that the current JWT token is invalid or expired, try regenerating a new token from your authentication provider.
- Verify authentication configuration: Double-check your authentication configuration settings to ensure they are correctly set up. Make sure you have provided all the necessary information for authentication, such as client ID, client secret, audience, etc.
- Check dependencies: Ensure that all required dependencies and libraries for handling JWT tokens are properly installed and up to date.
I hope this helps. Please do let us know if you have any further questions.
- akananeFrequent Visitor
Is there any documentation regarding the fix that you provided?
I was following the section: Introduction to Microsoft Spark utilities - Azure Synapse Analytics | Microsoft Learn. There is no mention of JWT tokens..- v-cboorla-msftMicrosoft Employee
Hi akanane
Apologies for the delay in response.
Currently mssparkutils supports only the below utilities.
fs:Utility for filesystem operations in Fabric
notebook:Utility for notebook operations (e.g, chaining Fabric notebooks together)
credentials:Utility for obtaining credentials (tokens and keys) for Fabric resources
lakehouse:Utility for lakehouse operations (e.g, create, delete, update, list lakehouse)It doesn't support the session utility, this is the reason why you are facing an issue while running the code "mssparkutils.session.stop()".
You can use spark.stop() :
If you have
sparkas a SparkSession object then callspark.stop()to stop the session. This ensures that resources are properly released and the Spark application terminates gracefully.I hope this helps. Please do let us know if you have any further questions.