Search code examples
jupyter-notebookinvoke

Invoke several Jupyter Notebook sequentially


Our team has developed python script to process data in 10 separated but functionally related jupyter notebooks, i.e. output of notebook 1 will be used as input for notebook 2 and so on.

Our next step is to automate the data processing process. Are there any ways to sequentially invoke jupyter notebooks?


Solution

  • nbconvert allows you to run notebooks. To run a notebook and replace the existing output with the new one, you can use.

    jupyter nbconvert --execute --to notebook --inplace <notebook>
    

    For more options and different approaches, you can have a look at this You can create a script with the above commands for each notebook and this should be able to execute the notebooks in the sequential order.

    Script:
    jupyter nbconvert --execute --to notebook --inplace <notebook1>
    jupyter nbconvert --execute --to notebook --inplace <notebook2>
    
    Run script.