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