Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Executing notebooks in specific order #1794

Open
agahkarakuzu opened this issue Jan 21, 2025 · 2 comments
Open

Executing notebooks in specific order #1794

agahkarakuzu opened this issue Jan 21, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@agahkarakuzu
Copy link

Proposal

Currently myst build --execute runs executable content asynchronously. However, when notebooks depend on one another, achieving synchronous execution requires hacky solutions, such as making one notebook wait for a specific file created by another.

Also, simultaneous execution can cause issues when multiple resource-intensive notebooks are included, mostly performance bottlenecks.

Would it be possible to introduce a feature in myst.yml to specify the execution order of notebooks? Incorporating memory flushing between notebook executions could greatly enhance efficiency and resource management.

Thank you!

@agahkarakuzu agahkarakuzu added the enhancement New feature or request label Jan 21, 2025
@rowanc1
Copy link
Member

rowanc1 commented Jan 23, 2025

I would be curious if you have a sketch at what some configuration might look like to achieve this?

@agahkarakuzu
Copy link
Author

It could be a part of the TOC such as:

 toc:
    - file: index.md
    - title: Example chapter
      children:
        - file: intro.md
        - file: notebook1.ipynb
          execution_order: 0
        - file: notebook2.ipynb
          execution_order: 1
        - file: notebook3.ipynb
          execution_order: 0
         

where notebooks sharing the same order (between 0-99) would be executed simultaneously. OR

 toc:
    - file: index.md
    - title: Example chapter
      children:
        - file: intro.md
        - file: notebook1.ipynb
        - file: notebook2.ipynb
          depends_on: notebook1.ipynb
        - file: notebook3.ipynb         

Maybe depends_on better implies that an error in notebook1 will prevent notebook2 from being executed. This would call for a bit more inference, maybe libraries like bee-queue can be of use?

TOC is the first that comes to my mind, yet resources field can be an alternative.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants