##// END OF EJS Templates
parallel: Use utils.localinterfaces.LOCALHOST
W. Trevor King -
Show More
@@ -26,6 +26,7 b' import zmq'
26 from zmq.eventloop import ioloop, zmqstream
26 from zmq.eventloop import ioloop, zmqstream
27
27
28 from IPython.config.configurable import LoggingConfigurable
28 from IPython.config.configurable import LoggingConfigurable
29 from IPython.utils.localinterfaces import LOCALHOST
29 from IPython.utils.traitlets import Int, Unicode, Instance, List
30 from IPython.utils.traitlets import Int, Unicode, Instance, List
30
31
31 #-----------------------------------------------------------------------------
32 #-----------------------------------------------------------------------------
@@ -43,7 +44,7 b' class LogWatcher(LoggingConfigurable):'
43 # configurables
44 # configurables
44 topics = List([''], config=True,
45 topics = List([''], config=True,
45 help="The ZMQ topics to subscribe to. Default is to subscribe to all messages")
46 help="The ZMQ topics to subscribe to. Default is to subscribe to all messages")
46 url = Unicode('tcp://127.0.0.1:20202', config=True,
47 url = Unicode('tcp://%s:20202' % LOCALHOST, config=True,
47 help="ZMQ url on which to listen for log messages")
48 help="ZMQ url on which to listen for log messages")
48
49
49 # internals
50 # internals
@@ -36,7 +36,7 b' from IPython.core.profiledir import ProfileDir, ProfileDirError'
36
36
37 from IPython.utils.coloransi import TermColors
37 from IPython.utils.coloransi import TermColors
38 from IPython.utils.jsonutil import rekey
38 from IPython.utils.jsonutil import rekey
39 from IPython.utils.localinterfaces import LOCAL_IPS
39 from IPython.utils.localinterfaces import LOCALHOST, LOCAL_IPS
40 from IPython.utils.path import get_ipython_dir
40 from IPython.utils.path import get_ipython_dir
41 from IPython.utils.py3compat import cast_bytes
41 from IPython.utils.py3compat import cast_bytes
42 from IPython.utils.traitlets import (HasTraits, Integer, Instance, Unicode,
42 from IPython.utils.traitlets import (HasTraits, Integer, Instance, Unicode,
@@ -427,7 +427,7 b' class Client(HasTraits):'
427
427
428 url = cfg['registration']
428 url = cfg['registration']
429
429
430 if location is not None and addr == '127.0.0.1':
430 if location is not None and addr == LOCALHOST:
431 # location specified, and connection is expected to be local
431 # location specified, and connection is expected to be local
432 if location not in LOCAL_IPS and not sshserver:
432 if location not in LOCAL_IPS and not sshserver:
433 # load ssh from JSON *only* if the controller is not on
433 # load ssh from JSON *only* if the controller is not on
@@ -30,6 +30,7 b' from zmq.eventloop.zmqstream import ZMQStream'
30
30
31 # internal:
31 # internal:
32 from IPython.utils.importstring import import_item
32 from IPython.utils.importstring import import_item
33 from IPython.utils.localinterfaces import LOCALHOST
33 from IPython.utils.py3compat import cast_bytes
34 from IPython.utils.py3compat import cast_bytes
34 from IPython.utils.traitlets import (
35 from IPython.utils.traitlets import (
35 HasTraits, Instance, Integer, Unicode, Dict, Set, Tuple, CBytes, DottedObjectName
36 HasTraits, Instance, Integer, Unicode, Dict, Set, Tuple, CBytes, DottedObjectName
@@ -176,17 +177,17 b' class HubFactory(RegistrationFactory):'
176 def _notifier_port_default(self):
177 def _notifier_port_default(self):
177 return util.select_random_ports(1)[0]
178 return util.select_random_ports(1)[0]
178
179
179 engine_ip = Unicode('127.0.0.1', config=True,
180 engine_ip = Unicode(LOCALHOST, config=True,
180 help="IP on which to listen for engine connections. [default: loopback]")
181 help="IP on which to listen for engine connections. [default: loopback]")
181 engine_transport = Unicode('tcp', config=True,
182 engine_transport = Unicode('tcp', config=True,
182 help="0MQ transport for engine connections. [default: tcp]")
183 help="0MQ transport for engine connections. [default: tcp]")
183
184
184 client_ip = Unicode('127.0.0.1', config=True,
185 client_ip = Unicode(LOCALHOST, config=True,
185 help="IP on which to listen for client connections. [default: loopback]")
186 help="IP on which to listen for client connections. [default: loopback]")
186 client_transport = Unicode('tcp', config=True,
187 client_transport = Unicode('tcp', config=True,
187 help="0MQ transport for client connections. [default : tcp]")
188 help="0MQ transport for client connections. [default : tcp]")
188
189
189 monitor_ip = Unicode('127.0.0.1', config=True,
190 monitor_ip = Unicode(LOCALHOST, config=True,
190 help="IP on which to listen for monitor messages. [default: loopback]")
191 help="IP on which to listen for monitor messages. [default: loopback]")
191 monitor_transport = Unicode('tcp', config=True,
192 monitor_transport = Unicode('tcp', config=True,
192 help="0MQ transport for monitor messages. [default : tcp]")
193 help="0MQ transport for monitor messages. [default : tcp]")
@@ -24,6 +24,7 b' from zmq.eventloop import ioloop, zmqstream'
24
24
25 from IPython.external.ssh import tunnel
25 from IPython.external.ssh import tunnel
26 # internal
26 # internal
27 from IPython.utils.localinterfaces import LOCALHOST
27 from IPython.utils.traitlets import (
28 from IPython.utils.traitlets import (
28 Instance, Dict, Integer, Type, Float, Integer, Unicode, CBytes, Bool
29 Instance, Dict, Integer, Type, Float, Integer, Unicode, CBytes, Bool
29 )
30 )
@@ -182,13 +183,13 b' class EngineFactory(RegistrationFactory):'
182 if self.max_heartbeat_misses > 0:
183 if self.max_heartbeat_misses > 0:
183 # Add a monitor socket which will record the last time a ping was seen
184 # Add a monitor socket which will record the last time a ping was seen
184 mon = self.context.socket(zmq.SUB)
185 mon = self.context.socket(zmq.SUB)
185 mport = mon.bind_to_random_port('tcp://127.0.0.1')
186 mport = mon.bind_to_random_port('tcp://%s' % LOCALHOST)
186 mon.setsockopt(zmq.SUBSCRIBE, b"")
187 mon.setsockopt(zmq.SUBSCRIBE, b"")
187 self._hb_listener = zmqstream.ZMQStream(mon, self.loop)
188 self._hb_listener = zmqstream.ZMQStream(mon, self.loop)
188 self._hb_listener.on_recv(self._report_ping)
189 self._hb_listener.on_recv(self._report_ping)
189
190
190
191
191 hb_monitor = "tcp://127.0.0.1:%i"%mport
192 hb_monitor = "tcp://%s:%i" % (LOCALHOST, mport)
192
193
193 heart = Heart(hb_ping, hb_pong, hb_monitor , heart_id=identity)
194 heart = Heart(hb_ping, hb_pong, hb_monitor , heart_id=identity)
194 heart.start()
195 heart.start()
@@ -24,6 +24,7 b' import zmq'
24 from zmq.eventloop.ioloop import IOLoop
24 from zmq.eventloop.ioloop import IOLoop
25
25
26 from IPython.config.configurable import Configurable
26 from IPython.config.configurable import Configurable
27 from IPython.utils.localinterfaces import LOCALHOST
27 from IPython.utils.traitlets import Integer, Instance, Unicode
28 from IPython.utils.traitlets import Integer, Instance, Unicode
28
29
29 from IPython.parallel.util import select_random_ports
30 from IPython.parallel.util import select_random_ports
@@ -39,15 +40,16 b' class RegistrationFactory(SessionFactory):'
39
40
40 url = Unicode('', config=True,
41 url = Unicode('', config=True,
41 help="""The 0MQ url used for registration. This sets transport, ip, and port
42 help="""The 0MQ url used for registration. This sets transport, ip, and port
42 in one variable. For example: url='tcp://127.0.0.1:12345' or
43 in one variable. For example: url='tcp://%s:12345' or
43 url='epgm://*:90210'""") # url takes precedence over ip,regport,transport
44 url='epgm://*:90210'"""
45 % LOCALHOST) # url takes precedence over ip,regport,transport
44 transport = Unicode('tcp', config=True,
46 transport = Unicode('tcp', config=True,
45 help="""The 0MQ transport for communications. This will likely be
47 help="""The 0MQ transport for communications. This will likely be
46 the default of 'tcp', but other values include 'ipc', 'epgm', 'inproc'.""")
48 the default of 'tcp', but other values include 'ipc', 'epgm', 'inproc'.""")
47 ip = Unicode('127.0.0.1', config=True,
49 ip = Unicode(LOCALHOST, config=True,
48 help="""The IP address for registration. This is generally either
50 help="""The IP address for registration. This is generally either
49 '127.0.0.1' for loopback only or '*' for all interfaces.
51 '127.0.0.1' for loopback only or '*' for all interfaces.
50 [default: '127.0.0.1']""")
52 [default: '%s']""" % LOCALHOST)
51 regport = Integer(config=True,
53 regport = Integer(config=True,
52 help="""The port on which the Hub listens for registration.""")
54 help="""The port on which the Hub listens for registration.""")
53 def _regport_default(self):
55 def _regport_default(self):
General Comments 0
You need to be logged in to leave comments. Login now