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

Allowed timeout to be none #260

Merged
merged 3 commits into from
Mar 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion nbconvert/nbconvertapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ def validate(self, obj, value):
},
"""Run nbconvert in place, overwriting the existing notebook (only
relevant when converting to notebook format)"""
)
),


})


Expand Down
9 changes: 7 additions & 2 deletions nbconvert/preprocessors/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@ class ExecutePreprocessor(Preprocessor):
Executes all the cells in a notebook
"""

timeout = Integer(30, config=True,
timeout = Integer(30, config=True, allow_none=True,
help=dedent(
"""
The time to wait (in seconds) for output from executions.
If a cell execution takes longer, an exception (TimeoutError
on python 3+, RuntimeError on python 2) is raised.

`None`, or `0` will disable the timeout.
"""
)
)
Expand Down Expand Up @@ -166,7 +168,10 @@ def run_cell(self, cell):
# wait for finish, with timeout
while True:
try:
msg = self.kc.shell_channel.get_msg(timeout=self.timeout)
timeout = self.timeout
if timeout <= 0:
timeout = None
msg = self.kc.shell_channel.get_msg(timeout=timeout)
except Empty:
self.log.error("""Timeout waiting for execute reply (%is).
If your cell should take longer than this, you can increase the timeout with:
Expand Down