项目作者: nteract

项目描述 :
:children_crossing: Spawn Jupyter Kernels
高级语言: JavaScript
项目地址: git://github.com/nteract/spawnteract.git
创建时间: 2016-01-22T04:37:03Z
项目社区:https://github.com/nteract/spawnteract

开源协议:

下载


Spawnteract

Spawn yourself a Jupyter kernel backend.

  1. npm install --save spawnteract

Usage

  1. const spawnteract = require('spawnteract')
  2. spawnteract.launch('python3').then(kernel => {
  3. // Returns
  4. // kernel.spawn <-- The running process, from child_process.spawn(...)
  5. // kernel.connectionFile <-- Connection file path
  6. // kernel.config <-- Connection information from the file
  7. // Print the ip address and port for the shell channel
  8. console.log(kernel.config.ip + ':' + kernel.config.shell_port);
  9. })

spawnteract will automatically delete the connection file after the kernel
process exits or errors out.

To disable this feature, set cleanupConnectionFile to false in the spawnOptions:

  1. launch(kernelName, { cleanupConnectionFile: false });

You’ll should close kernel.spawn when a user shuts down the kernel. If you disabled automatic cleanup, you will need to delete kernel.connectionFile from disk when finished:

  1. function cleanup(kernel) {
  2. kernel.spawn.kill();
  3. // Only do this second part if you opted out of automatic cleanup:
  4. fs.unlink(kernel.connectionFile);
  5. }

For more info, see our changelog
or open an issue with questions

You will probably end up wanting to use this with enchannel-zmq-backend.