[英]How do I cron an ipython jupyter notebook's cells?
I have an ipython jupyter notebook that I've developed and run from Django 1.8 with: 我有一个从Django 1.8开发并运行的ipython jupyter笔记本,其使用:
manage.py shell_plus --notebook
Within the notebook I have written some data analytics and reporting modules that produce CSV and HTML output via petl and pandas. 在笔记本中,我编写了一些数据分析和报告模块,这些模块通过petl和pandas生成CSV和HTML输出。
I'd like to automate the notebook in such a way that I can simply cron the notebook cells to execute and then serve the static HTML output, but I don't see a way to run the cells within the notebook without a human driving the process, ie from cron. 我想以这样一种方式来自动化笔记本电脑:可以简单地将笔记本电脑的单元格执行起来,然后提供静态HTML输出,但是我没有看到一种无需人工操作即可运行笔记本电脑内的单元格的方法。过程,即来自cron。
Nbconvert has a --execute
flag to run a notebook before converting it to another format. Nbconvert有
--execute
标志将其转换为另一种格式之前运行的笔记本电脑。
So for instance, to run a notebook and convert to static HTML: 因此,例如,要运行笔记本并转换为静态HTML:
ipython nbconvert --execute --to html MyNotebook.ipynb
If you want to run it and save the results as an ipynb file, you can use --to notebook
. 如果要运行它并将结果保存为ipynb文件,则可以使用
--to notebook
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.