aaren/notedown

Allow overriding of cell timeout setting

jni opened this issue · 6 comments

jni commented

When executing a long-running cell, notedown times out.

notedown --match fenced --run markdown/ch7.markdown --output build_ipynb/ch7.ipynb
ERROR:root:Timeout waiting for execute reply
ERROR:root:failed to run cell: Empty()
ERROR:root:# dm6.fa.gz can be downloaded from ftp://hgdownload.cse.ucsc.edu/goldenPath/dm6/bigZips/
# Unzip before using: gzip -d dm6.fa.gz
dm = 'data/dm6.fa'
model = tz.pipe(dm, genome, markov)
Traceback (most recent call last):
  File "/Users/hdashnow/anaconda/envs/elegant/bin/notedown", line 9, in <module>
    load_entry_point('notedown==1.4.4', 'console_scripts', 'notedown')()
  File "/Users/hdashnow/anaconda/envs/elegant/lib/python3.4/site-packages/notedown/main.py", line 275, in app
    main(args, help=parser.format_help())
  File "/Users/hdashnow/anaconda/envs/elegant/lib/python3.4/site-packages/notedown/main.py", line 241, in main
    run(notebook)
  File "/Users/hdashnow/anaconda/envs/elegant/lib/python3.4/site-packages/notedown/notedown.py", line 43, in run
    notebook, resources = executor.preprocess(notebook, resources={})
  File "/Users/hdashnow/anaconda/envs/elegant/lib/python3.4/site-packages/IPython/nbconvert/preprocessors/execute.py", line 39, in preprocess
    nb, resources = super(ExecutePreprocessor, self).preprocess(nb, resources)
  File "/Users/hdashnow/anaconda/envs/elegant/lib/python3.4/site-packages/IPython/nbconvert/preprocessors/base.py", line 70, in preprocess
    nb.cells[index], resources = self.preprocess_cell(cell, resources, index)
  File "/Users/hdashnow/anaconda/envs/elegant/lib/python3.4/site-packages/IPython/nbconvert/preprocessors/execute.py", line 49, in preprocess_cell
    outputs = self.run_cell(cell)
  File "/Users/hdashnow/anaconda/envs/elegant/lib/python3.4/site-packages/IPython/nbconvert/preprocessors/execute.py", line 63, in run_cell
    msg = self.kc.shell_channel.get_msg(timeout=self.timeout)
  File "/Users/hdashnow/anaconda/envs/elegant/lib/python3.4/site-packages/IPython/kernel/blocking/channels.py", line 57, in get_msg
    raise Empty
queue.Empty

It looks like the ExecutePreprocessor has a settable timeout (defaulting to 30 seconds) but I don't understand how to set it...

aaren commented

I remember this coming up on ipython-dev this year. Should be fixable- would a command line switch do it? What should the default be?

jni commented

Yes, a command line switch would be my preferred solution. I guess the default should be not touching the IPython default?

aaren commented

There is now a --timeout=integer argument that defaults to 30s (the ipython default).

aaren commented

In the meantime I've supported IPython 4. I'll cut a release when I'm sure that has gone ok.

jni commented

Wow, awesome, thanks @aaren! Will test this out in next few days!

aaren commented

This has now been released in 1.5.0.