Parsing the output of a Jupyter Notebook

I need to understand if a Notebook has been run completely and retrieve the values for cell execution.

Is it possible to perform this programmatically?

Yes, you can check if the final cell in your notebook as been run and get any output programmatically with nbformat. The underlying principle is touched upon in my reply to ’ Extract specific cells from students’ notebooks’ here. (As a related proof of concept, I also wrote up code to collect only previously executed cells from a notebook and save them to a new notebook here.) In your case, you’d want to collect the cells and check if the last one has run. Or at least collect the output of cells and grab the output you seek. I have several posts with nbformat code examples that you can find here, here, and here that all use nbformat and may aid in your piecing together a solution yourself. How general or specific you make the check for completeness of notebook execution depends on your needs. If you want some specific help, message me directly here and I’d be happy to help you work on it.

Also, depending on how you are running your notebook in the first place, you may already have the information about whether the notebook has run completely. If you run it programmatically with nbconvert, jupytext, or papermill then you’ll know if it ran without error if the task completes with no issues. If you aren’t running the notebook that way, it may be worth it to incorporate into your pipeline for robustness.