Show More
@@ -371,12 +371,12 b' class IPythonQtConsoleApp(BaseIPythonApplication):' | |||
|
371 | 371 | signal.signal(signal.SIGINT, signal.SIG_DFL) |
|
372 | 372 | |
|
373 | 373 | # Create a KernelManager and start a kernel. |
|
374 | self.kernel_manager = QtKernelManager( | |
|
375 |
shell_ |
|
|
376 |
sub_ |
|
|
377 |
stdin_ |
|
|
378 |
hb_ |
|
|
379 | config=self.config | |
|
374 | self.kernel_manager = QtKernelManager(ip=self.ip, | |
|
375 | shell_port=self.shell_port, | |
|
376 | sub_port=self.iopub_port, | |
|
377 | stdin_port=self.stdin_port, | |
|
378 | hb_port=self.hb_port, | |
|
379 | config=self.config, | |
|
380 | 380 | ) |
|
381 | 381 | # start the kernel |
|
382 | 382 | if not self.existing: |
@@ -16,7 +16,6 b' TODO' | |||
|
16 | 16 | #----------------------------------------------------------------------------- |
|
17 | 17 | |
|
18 | 18 | # Standard library imports. |
|
19 | import atexit | |
|
20 | 19 | import errno |
|
21 | 20 | from Queue import Queue, Empty |
|
22 | 21 | from subprocess import Popen |
@@ -24,7 +23,6 b' import signal' | |||
|
24 | 23 | import sys |
|
25 | 24 | from threading import Thread |
|
26 | 25 | import time |
|
27 | import logging | |
|
28 | 26 | |
|
29 | 27 | # System library imports. |
|
30 | 28 | import zmq |
@@ -33,10 +31,9 b' from zmq.eventloop import ioloop' | |||
|
33 | 31 | |
|
34 | 32 | # Local imports. |
|
35 | 33 | from IPython.config.loader import Config |
|
36 | from IPython.utils import io | |
|
37 | 34 | from IPython.utils.localinterfaces import LOCALHOST, LOCAL_IPS |
|
38 |
from IPython.utils.traitlets import HasTraits, Any, Instance, Type, |
|
|
39 |
from session import Session |
|
|
35 | from IPython.utils.traitlets import HasTraits, Any, Instance, Type, Unicode, Int | |
|
36 | from session import Session | |
|
40 | 37 | |
|
41 | 38 | #----------------------------------------------------------------------------- |
|
42 | 39 | # Constants and exceptions |
@@ -705,10 +702,11 b' class KernelManager(HasTraits):' | |||
|
705 | 702 | kernel = Instance(Popen) |
|
706 | 703 | |
|
707 | 704 | # The addresses for the communication channels. |
|
708 | shell_address = TCPAddress((LOCALHOST, 0)) | |
|
709 | sub_address = TCPAddress((LOCALHOST, 0)) | |
|
710 | stdin_address = TCPAddress((LOCALHOST, 0)) | |
|
711 | hb_address = TCPAddress((LOCALHOST, 0)) | |
|
705 | ip = Unicode(LOCALHOST) | |
|
706 | shell_port = Int(0) | |
|
707 | sub_port = Int(0) | |
|
708 | stdin_port = Int(0) | |
|
709 | hb_port = Int(0) | |
|
712 | 710 | |
|
713 | 711 | # The classes to use for the various channels. |
|
714 | 712 | shell_channel_class = Type(ShellSocketChannel) |
@@ -795,10 +793,7 b' class KernelManager(HasTraits):' | |||
|
795 | 793 | **kw : optional |
|
796 | 794 | See respective options for IPython and Python kernels. |
|
797 | 795 | """ |
|
798 | shell, sub, stdin, hb = self.shell_address, self.sub_address, \ | |
|
799 | self.stdin_address, self.hb_address | |
|
800 | if shell[0] not in LOCAL_IPS or sub[0] not in LOCAL_IPS or \ | |
|
801 | stdin[0] not in LOCAL_IPS or hb[0] not in LOCAL_IPS: | |
|
796 | if self.ip not in LOCAL_IPS: | |
|
802 | 797 | raise RuntimeError("Can only launch a kernel on a local interface. " |
|
803 | 798 | "Make sure that the '*_address' attributes are " |
|
804 | 799 | "configured properly. " |
@@ -812,13 +807,13 b' class KernelManager(HasTraits):' | |||
|
812 | 807 | from ipkernel import launch_kernel |
|
813 | 808 | else: |
|
814 | 809 | from pykernel import launch_kernel |
|
815 |
self.kernel, |
|
|
816 |
shell_port=s |
|
|
817 |
stdin_port=s |
|
|
818 |
self.shell_ |
|
|
819 |
self.sub_ |
|
|
820 |
self.stdin_ |
|
|
821 |
self.hb_ |
|
|
810 | self.kernel, shell, sub, stdin, hb = launch_kernel( | |
|
811 | shell_port=self.shell_port, iopub_port=self.sub_port, | |
|
812 | stdin_port=self.stdin_port, hb_port=self.hb_port, **kw) | |
|
813 | self.shell_port = shell | |
|
814 | self.sub_port = sub | |
|
815 | self.stdin_port = stdin | |
|
816 | self.hb_port = hb | |
|
822 | 817 | |
|
823 | 818 | def shutdown_kernel(self, restart=False): |
|
824 | 819 | """ Attempts to the stop the kernel process cleanly. If the kernel |
@@ -967,7 +962,7 b' class KernelManager(HasTraits):' | |||
|
967 | 962 | if self._shell_channel is None: |
|
968 | 963 | self._shell_channel = self.shell_channel_class(self.context, |
|
969 | 964 | self.session, |
|
970 |
self.shell_ |
|
|
965 | (self.ip, self.shell_port)) | |
|
971 | 966 | return self._shell_channel |
|
972 | 967 | |
|
973 | 968 | @property |
@@ -976,7 +971,7 b' class KernelManager(HasTraits):' | |||
|
976 | 971 | if self._sub_channel is None: |
|
977 | 972 | self._sub_channel = self.sub_channel_class(self.context, |
|
978 | 973 | self.session, |
|
979 |
self. |
|
|
974 | (self.ip, self.sub_port)) | |
|
980 | 975 | return self._sub_channel |
|
981 | 976 | |
|
982 | 977 | @property |
@@ -985,7 +980,7 b' class KernelManager(HasTraits):' | |||
|
985 | 980 | if self._stdin_channel is None: |
|
986 | 981 | self._stdin_channel = self.stdin_channel_class(self.context, |
|
987 | 982 | self.session, |
|
988 |
self.stdin_ |
|
|
983 | (self.ip, self.stdin_port)) | |
|
989 | 984 | return self._stdin_channel |
|
990 | 985 | |
|
991 | 986 | @property |
@@ -995,5 +990,5 b' class KernelManager(HasTraits):' | |||
|
995 | 990 | if self._hb_channel is None: |
|
996 | 991 | self._hb_channel = self.hb_channel_class(self.context, |
|
997 | 992 | self.session, |
|
998 |
self. |
|
|
993 | (self.ip, self.hb_port)) | |
|
999 | 994 | return self._hb_channel |
General Comments 0
You need to be logged in to leave comments.
Login now