Forum Discussion
Notebook shows 'In Progress' in Monitor App even after it has returned with an error?
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.
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!