nbval
nbval copied to clipboard
Is it possible to set time for running each notebook cell with nbval?
Hello nbval folks, first of all thanks a lot for your plugin! :) We've decided to use it on ipycytoscape but we found a problem. Currently we're having the following error on MacOS:
Notebook cell execution failed
Cell 2: Timeout of 5 seconds exceeded waiting for output.
The way libs like nbconvert are dealing with this is allowing the user to pass a flag that tells jupyter to wait an X amount of time for the cell finish loading with flags like this one: --ExecutePreprocessor.timeout=600 , docs.
Is it possible to do something similar on nbval?
Thanks a lot, please let me know if I can help somehow :)
So my understanding of this error is that it is slightly different than the nbconvert case. In this case:
- The cell execute request is sent.
- The execution is processed.
- The
execute_replymessage is received. - All further messages are awaited with a hard-coded timeout of 5 seconds per message receipt (until an
execution_state: idlemessage is received).
For steps 1-3, a different timeout is used (which is configurable, via --nbval-cell-timeout which defaults to 2000 seconds).
I'm not entirely sure what is going on for the messages (after execution has finished) to take so long to send/process.
We could certainly make this configurable, but I just want to make sure it is the right fix. For now, could you try increasing this value in your local copy to A: see that it actually fixes the problem, and secondarily B: give some indication of how long is needed?
https://github.com/computationalmodelling/nbval/blob/3597e0bfd96c8b52d9f4e94abbe1cbb3887dcf25/nbval/plugin.py#L336
I was checking the --nbval-cell-timeout and it seems to have no effect, even with setting value to 300 I get the same error
Notebook cell execution failed
Cell X: Timeout of 5 seconds exceeded waiting for output.
According to the JupyterLab folks, timeout is not standard metadata, and it is being ignored:
https://github.com/jupyterlab/jupyterlab/issues/12018
See specifically https://github.com/jupyterlab/jupyterlab/issues/12018#issuecomment-1046571679
Is there any plan to fix it or support it?
We're interested in continuing to use nbval within a CI context due to its ability to check the outputs stored in our notebooks. Many of the cells in our notebooks have large execution times, and thus we are stuck due to the timeout flag being ignored.