-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add a pre- and post-execution hooks #22
Comments
To give some more context here:
|
@fcollonval @echarles any preferences on how we should implement hooks? On frontend these are just
My own thoughs:
|
Thanks for raising the question @krassowski Small question related to the need and setting aside the specific case of timing, would using the Jupyter Server events answer the need or do you see other cases like the timing that the reaction should be called immediately? |
Great point! For the use case of "send me an email when execution finished", I think Jupyter Server event could be good enough. For feature parity: frontend has
It could be interesting to explore pre-execution hooks that would allow to modify the code but I think this is a larger conversation and not required right now. Shall we just add event emitter then? |
I would go that road as it is anyway a good addition. But let's keep this issue opened for further exploration. |
Problem
Proposed Solution
Allow extensions to register pre- and post-execution functions to run which would be allowed to populate the cell metadata.
Maybe special-case execution timing as a hook that is available by default, and enabled based on an argument passed to the JSON API?
Additional context
The timing metadata population is implemented in JupyterLab here:
https://github.com/jupyterlab/jupyterlab/blob/ef5a055976e02fee6c4d877a6a6df756f3323f79/packages/cells/src/widget.ts#L1736-L1787
I see there is a TODO note in this repository about it:
jupyter-server-nbmodel/src/executor.ts
Line 122 in da00ed8
The text was updated successfully, but these errors were encountered: