Related discussion: #156
The team I work with have been trying to figure out a simple way to prolong the timeout for cell output as we're running into this issue in some of my testing pipelines.
Our use case is that we rely on pytest --nbval to run integration tests on several notebooks across multiple projects for a computation platform and some notebooks require a slightly longer timeout. This means that we have occasional failure/success for some notebooks, so not ideal.
We were hoping to be able to supply a timeout manually or via pytest configurations, but this appears to not be fully implemented.
Copying a comment from my colleague (@fmigneault):
I'm having a hard time understanding how the default 2000s (
|
group.addoption('--nbval-cell-timeout', action='store', default=2000, |
|
type=float, |
|
help='Timeout for cell execution, in seconds.') |
) was not applied in favour of the hardcoded 5s:
Looking at the code, it seems like the timeout is used to get the initial message, but is never actually employed to get the long output:
|
timeout = self.config.option.nbval_cell_timeout |
|
timed_out_this_run = False |
|
|
|
# Poll the shell channel to get a message |
|
try: |
|
self.parent.kernel.await_reply(msg_id, timeout=timeout) |
|
except Empty: # Timeout reached |
|
# Try to interrupt kernel, as this will give us traceback: |
|
kernel.interrupt() |
|
self.parent.timed_out = True |
|
timed_out_this_run = True |
|
|
|
# This list stores the output information for the entire cell |
|
outs = [] |
|
# TODO: Only store if comparing with nbdime, to save on memory usage |
|
self.test_outputs = outs |
|
|
|
# Now get the outputs from the iopub channel |
|
while True: |
|
# The iopub channel broadcasts a range of messages. We keep reading |
|
# them until we find the message containing the side-effects of our |
|
# code execution. |
|
try: |
|
# Get a message from the kernel iopub channel |
|
msg = self.parent.get_kernel_message(timeout=self.output_timeout) |
|
|
We're wondering if there is a maybe an undocumented method to modify the notebook cell timeout or perhaps the fix mentioned in #156 could be reconsidered.
Context: Ouranosinc/PAVICS-e2e-workflow-tests#171
Related discussion: #156
The team I work with have been trying to figure out a simple way to prolong the timeout for cell output as we're running into this issue in some of my testing pipelines.
Our use case is that we rely on
pytest --nbvalto run integration tests on several notebooks across multiple projects for a computation platform and some notebooks require a slightly longer timeout. This means that we have occasional failure/success for some notebooks, so not ideal.We were hoping to be able to supply a timeout manually or via
pytestconfigurations, but this appears to not be fully implemented.Copying a comment from my colleague (@fmigneault):
We're wondering if there is a maybe an undocumented method to modify the notebook cell timeout or perhaps the fix mentioned in #156 could be reconsidered.
Context: Ouranosinc/PAVICS-e2e-workflow-tests#171