Show More
@@ -3,6 +3,7 b' launchers.' | |||||
3 | """ |
|
3 | """ | |
4 |
|
4 | |||
5 | # Standard library imports. |
|
5 | # Standard library imports. | |
|
6 | import atexit | |||
6 | import os |
|
7 | import os | |
7 | import socket |
|
8 | import socket | |
8 | from subprocess import Popen, PIPE |
|
9 | from subprocess import Popen, PIPE | |
@@ -84,6 +85,8 b' def make_kernel(namespace, kernel_factory,' | |||||
84 | # Create a context, a session, and the kernel sockets. |
|
85 | # Create a context, a session, and the kernel sockets. | |
85 | io.raw_print("Starting the kernel at pid:", os.getpid()) |
|
86 | io.raw_print("Starting the kernel at pid:", os.getpid()) | |
86 | context = zmq.Context() |
|
87 | context = zmq.Context() | |
|
88 | # Uncomment this to try closing the context. | |||
|
89 | # atexit.register(context.close) | |||
87 | session = Session(username=u'kernel') |
|
90 | session = Session(username=u'kernel') | |
88 |
|
91 | |||
89 | reply_socket = context.socket(zmq.XREP) |
|
92 | reply_socket = context.socket(zmq.XREP) |
@@ -16,6 +16,7 b' TODO' | |||||
16 | #----------------------------------------------------------------------------- |
|
16 | #----------------------------------------------------------------------------- | |
17 |
|
17 | |||
18 | # Standard library imports. |
|
18 | # Standard library imports. | |
|
19 | import atexit | |||
19 | from Queue import Queue, Empty |
|
20 | from Queue import Queue, Empty | |
20 | from subprocess import Popen |
|
21 | from subprocess import Popen | |
21 | import signal |
|
22 | import signal | |
@@ -654,7 +655,7 b' class KernelManager(HasTraits):' | |||||
654 | sub_channel_class = Type(SubSocketChannel) |
|
655 | sub_channel_class = Type(SubSocketChannel) | |
655 | rep_channel_class = Type(RepSocketChannel) |
|
656 | rep_channel_class = Type(RepSocketChannel) | |
656 | hb_channel_class = Type(HBSocketChannel) |
|
657 | hb_channel_class = Type(HBSocketChannel) | |
657 |
|
658 | |||
658 | # Protected traits. |
|
659 | # Protected traits. | |
659 | _launch_args = Any |
|
660 | _launch_args = Any | |
660 | _xreq_channel = Any |
|
661 | _xreq_channel = Any | |
@@ -662,6 +663,10 b' class KernelManager(HasTraits):' | |||||
662 | _rep_channel = Any |
|
663 | _rep_channel = Any | |
663 | _hb_channel = Any |
|
664 | _hb_channel = Any | |
664 |
|
665 | |||
|
666 | def __init__(self, **kwargs): | |||
|
667 | super(KernelManager, self).__init__(**kwargs) | |||
|
668 | atexit.register(self.context.close) | |||
|
669 | ||||
665 | #-------------------------------------------------------------------------- |
|
670 | #-------------------------------------------------------------------------- | |
666 | # Channel management methods: |
|
671 | # Channel management methods: | |
667 | #-------------------------------------------------------------------------- |
|
672 | #-------------------------------------------------------------------------- |
General Comments 0
You need to be logged in to leave comments.
Login now