Commit 40b45870 authored by Ludovic Courtès's avatar Ludovic Courtès
Browse files

jupyter-server: Use keyword arguments.

* guix-kernel/jupyter-server.scm (new-connection-file): Change to use
keyword arguments.  Use 'call-with-output-file' instead of
(run-kernel): Adjust accordingly.
parent da295031
......@@ -60,7 +60,11 @@ could not be found."
;; Running procedure.
(define (new-connection-file control shell hb stdin iosub type ip key)
(define* (new-connection-file type ip key
#:key control shell heartbeat stdin iosub)
"Return the file name of a new JSON \"connection file\" for the given IP
and TYPE (e.g., \"tcp\"), with the given notebook KEY, and the specified
(let* ((scm `(("transport" . ,type)
("ip" . ,ip)
("signature_scheme" . "hmac-sha256")
......@@ -68,19 +72,17 @@ could not be found."
("control_port" . ,control)
("shell_port" . ,shell)
("stdin_port" . ,stdin)
("hb_port" . ,hb)
("hb_port" . ,heartbeat)
("iopub_port" . ,iosub)))
(json (scm->json-string scm))
(file-path (string-append
(number->string (string-hash json))
(mkdir-p "/tmp/guix-kernel/conn/")
(let ((file (open-output-file file-path)))
(scm->json scm file #:pretty #t)
(close file)
(file (string-append "/tmp/guix-kernel/conn/"
(number->string (string-hash json))
(mkdir-p (dirname file))
(call-with-output-file file
(lambda (port)
(scm->json scm port #:pretty #t)
(define (test-bind socket port)
(catch 'zmq-error
......@@ -149,14 +151,15 @@ return its PID."
(port-heartbeat (test-bind socket-heartbeat (++ port-stdin)))
(port-iosub (test-bind socket-iosub (++ port-heartbeat)))
(connection-file (new-connection-file port-control port-shell
port-heartbeat port-stdin
"tcp" ""
(connection-file (new-connection-file "tcp" "" key
#:control port-control
#:shell port-shell
#:heartbeat port-heartbeat
#:stdin port-stdin
#:iosub port-iosub))
(pid (exec-kernel name connection-file))
(addr "tcp://")
(addr-p (lambda (port)
(string-append addr
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