Attention une mise à jour du service Gitlab va être effectuée le mardi 14 décembre entre 13h30 et 14h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes.

Commit b7b2ff26 authored by Ludovic Courtès's avatar Ludovic Courtès
Browse files

kernels: Distinguish between 'exec-kernel' and 'spawn-kernel'.

* jupyter/kernels.scm (exec-kernel): New procedure.
(spawn-kernel): Rewrite to use it.
parent 8954b810
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
#:use-module (srfi srfi-71) #:use-module (srfi srfi-71)
#:export (find-kernel-specs #:export (find-kernel-specs
find-kernel-specs-file find-kernel-specs-file
exec-kernel
spawn-kernel
run-kernel run-kernel
kernel-specs? kernel-specs?
...@@ -302,9 +304,9 @@ be in use (but this is racy)." ...@@ -302,9 +304,9 @@ be in use (but this is racy)."
(values connection kernel))) (values connection kernel)))
(define (spawn-kernel specs connection) (define (exec-kernel specs connection)
"Spawn the kernel specified by SPECS, a <kernel-specs> record, passing it "Execute the kernel specified by SPECS, a <kernel-specs> record, passing it
CONNECTION serialized to a \"connection file\". Return its PID." CONNECTION serialized to a \"connection file\"."
(define connection-file (define connection-file
(string-append "/tmp/guix-kernel/conn/" (string-append "/tmp/guix-kernel/conn/"
(number->string (string-hash (number->string (string-hash
...@@ -324,9 +326,15 @@ CONNECTION serialized to a \"connection file\". Return its PID." ...@@ -324,9 +326,15 @@ CONNECTION serialized to a \"connection file\". Return its PID."
(scm->json (connection->json connection) port (scm->json (connection->json connection) port
#:pretty #t))) #:pretty #t)))
(apply execlp (first arguments) arguments))
(define (spawn-kernel specs connection)
"Spawn the kernel designated by SPECS, a <kernel-specs> record, as a new
process, and return its PID. Pass it CONNECTION serialized to a \"connection
file\"."
(let ((pid (primitive-fork))) (let ((pid (primitive-fork)))
(if (zero? pid) (if (zero? pid)
(apply execlp (first arguments) arguments) (exec-kernel specs connection)
pid))) pid)))
(define search-path->list (define search-path->list
......
Markdown is supported
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