Forum Discussion
Notebook shows 'In Progress' in Monitor App even after it has returned with an error?
Each notebook activity in the Monitor hub represents the spark application for a session. When you run a notebook, it initializes a spark session and creates a spark application. The "Status" represents the status of the session, rather than the running status of a code snippet in the notebook.
You can also use notebookutils.session.stop() to stop an interactive session and release resources occupied by the session. NotebookUtils (former MSSparkUtils) for Fabric - Microsoft Fabric | Microsoft Learn
Best Regards,
Jing
- IntegrateGuru1 year agoAdvocate I
Thanks, this seems correct.
Is there any way to set the status of a notebook to 'failed' then? We want to be able to view when our scripts run into errors, using an activator that listens to the activity status to go to a failed state.- Anonymous1 year agoNot applicable
If you want to view the contextual monitoring logs after running an interactive notebook, there are logs below every code cell. Notebook contextual monitoring and debugging - Microsoft Fabric | Microsoft Learn
If you want to set the status of a notebook to "failed", perhaps you can consider creating a data pipeline to invoke the notebook. Monitor the status of the notebook activity or the output of the notebook. One idea is:
- At the ending cell of a notebook, use notebookutils.notebook.exit() to exit a notebook with an exit value like "Failed".
- Create a data pipeline to invoke the notebook (Notebook activity). When you orchestrate a notebook in a pipeline that calls an exit() function, the notebook activity returns with an exit value, completes the pipeline run, and stops the Spark session.
- Check the snapshot of a notebook activity in the data pipeline to know its status and snapshot in a run: Snapshot of Notebook from Pipeline in ... - Microsoft Fabric Community
- (Alternative) You can also add a Fail activity after the notebook activity, and customize its error messages and error codes.
Hope this would be helpful.
Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!