IPython Notebook - 在Javascript中检测内核是否忙/闲 [英] IPython Notebook - Detect if Kernel is Busy/Idle in Javascript

查看:88
本文介绍了IPython Notebook - 在Javascript中检测内核是否忙/闲的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试使用IPython笔记本进行交互式绘图。我遇到的一个问题是,当在javascript中通过IPython.notebook.kernel.execute方法执行Python代码时,我无法知道该段代码何时完成执行。是否有一种简单的方法可以检测内核是忙还是空闲,这样我就可以告诉Javascript闲置直到它完成?

I'm currently trying to get interactive plots working with IPython notebook. One of the issues I'm having is the fact that when executing Python code through the IPython.notebook.kernel.execute method in javascript I have no way of knowing when that piece of code has finished executing. Is there an easy way of detecting whether the kernel is busy/idle so that I can tell Javascript to idle until it's completed?

推荐答案

内核状态可能就是你要找的东西:

The Kernel status is probably what you are looking for:

http://ipython.org/ipython-doc/dev/development/messaging.html#kernel-status

你可以在IPython笔记本的kernel.js中找到一些额外的灵感(只搜索忙):

You can find some additional inspiration in the kernel.js of the IPython notebook (just search for "busy"):

https://github.com/ipython/ipython/blob/ master / IPython / frontend / html / notebook / static / js / kernel.js

这篇关于IPython Notebook - 在Javascript中检测内核是否忙/闲的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆