Commit 3b418494 authored by Ludovic Courtès's avatar Ludovic Courtès
Browse files

kernels: Add 'kernel-sockets'.

* jupyter/kernels.scm (kernel-sockets): New procedure.
(close-kernel): Use it.
parent 6874b76c
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
kernel-heartbeat kernel-heartbeat
kernel-iosub kernel-iosub
kernel-iopub ;alias kernel-iopub ;alias
kernel-sockets
read-message read-message
send-message send-message
...@@ -82,14 +83,19 @@ ...@@ -82,14 +83,19 @@
(%kernel name pid key (%kernel name pid key
control shell standard-input heartbeat iosub)) control shell standard-input heartbeat iosub))
(define (kernel-sockets kernel)
"Return all the ZeroMQ sockets associated with KERNEL."
(map (lambda (socket)
(socket kernel))
(list kernel-shell
kernel-control
kernel-standard-input
kernel-heartbeat
kernel-iopub)))
(define (close-kernel kernel) (define (close-kernel kernel)
"Close all the open connections of KERNEL." "Close all the open connections of KERNEL."
(for-each zmq-close-socket (for-each zmq-close-socket (kernel-sockets kernel)))
(map (lambda (proc)
(proc kernel))
(list kernel-control kernel-shell
kernel-standard-input
kernel-heartbeat kernel-iopub))))
(define (jupyter-kernel-path) (define (jupyter-kernel-path)
"Return the default search path for Jupyter kernels." "Return the default search path for Jupyter kernels."
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment