##// END OF EJS Templates
parallel.util: Use utils.localinterfaces...
W. Trevor King -
Show More
@@ -43,6 +43,7 b' from IPython.external.decorator import decorator'
43
43
44 # IPython imports
44 # IPython imports
45 from IPython.config.application import Application
45 from IPython.config.application import Application
46 from IPython.utils.localinterfaces import LOCALHOST, PUBLIC_IPS
46 from IPython.zmq.log import EnginePUBHandler
47 from IPython.zmq.log import EnginePUBHandler
47 from IPython.zmq.serialize import (
48 from IPython.zmq.serialize import (
48 unserialize_object, serialize_object, pack_apply_message, unpack_apply_message
49 unserialize_object, serialize_object, pack_apply_message, unpack_apply_message
@@ -186,14 +187,9 b' def disambiguate_ip_address(ip, location=None):'
186 """turn multi-ip interfaces '0.0.0.0' and '*' into connectable
187 """turn multi-ip interfaces '0.0.0.0' and '*' into connectable
187 ones, based on the location (default interpretation of location is localhost)."""
188 ones, based on the location (default interpretation of location is localhost)."""
188 if ip in ('0.0.0.0', '*'):
189 if ip in ('0.0.0.0', '*'):
189 try:
190 if location is None or location in PUBLIC_IPS or not PUBLIC_IPS:
190 external_ips = socket.gethostbyname_ex(socket.gethostname())[2]
191 except (socket.gaierror, IndexError):
192 # couldn't identify this machine, assume localhost
193 external_ips = []
194 if location is None or location in external_ips or not external_ips:
195 # If location is unspecified or cannot be determined, assume local
191 # If location is unspecified or cannot be determined, assume local
196 ip='127.0.0.1'
192 ip = LOCALHOST
197 elif location:
193 elif location:
198 return location
194 return location
199 return ip
195 return ip
General Comments 0
You need to be logged in to leave comments. Login now