Attention une mise à jour du service Gitlab va être effectuée le mardi 18 janvier (et non lundi 17 comme annoncé précédemment) entre 18h00 et 18h30. 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 6d550be4 authored by Ludovic Courtès's avatar Ludovic Courtès
Browse files

inner-proxy: Save the ZeroMQ context as a state property.

* guix/jupyter/inner-proxy.scm (%context): Remove.
(%zmq-context-property): New variable.
(reply-execute-request): Use 'proxy-state-property' instead of referring
to '%context'.
(run-inner-proxy): Call 'zmq-create-context' here, and save the context
as a %ZMQ-CONTEXT-PROPERTY property of the state.
parent 95fdf89d
......@@ -48,9 +48,9 @@
;;;
;;; Code:
;; ZeroMQ context.
;; FIXME: Avoid doing that at the top level.
(define %context (zmq-create-context))
(define %zmq-context-property
;; Key used to access the ZeroMQ context in <proxy-state>.
(list 'zmq 'context))
;;
;; Execution.
......@@ -197,10 +197,11 @@ stripped."
(increment-execution-count state))
(match (find-kernel-specs name)
((? kernel-specs? specs)
(let* ((new-kernel (run-kernel %context specs
(generate-key)))
(state (register-proxied name new-kernel
state)))
(let* ((context (proxy-state-property state
%zmq-context-property))
(new-kernel (run-kernel context specs
(generate-key)))
(state (register-proxied name new-kernel state)))
(monitor-client new-kernel)
(send-message new-kernel message)
(increment-execution-count state)))
......@@ -236,10 +237,12 @@ stripped."
(define (run-inner-proxy session-id connection)
"Run an inner for SESSION-ID, with its client at CONNECTION."
(let* ((kernel (connection->kernel connection
#:context %context))
(let* ((context (zmq-create-context))
(kernel (connection->kernel connection
#:context context))
(state (proxy-state kernel)))
(format/log "started proxy as PID ~a~%" (getpid))
(serve-kernels (list kernel)
(proxy-request-handler dispatch-route)
state)))
(set-proxy-state-property state %zmq-context-property
context))))
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