Skip to content

Commit

Permalink
Alternative way of listening on all interfaces for the bokeh server (#…
Browse files Browse the repository at this point in the history
…135)

Alternative way of listening on all interfaces for the bokeh server.
  • Loading branch information
lesteve authored and guillaumeeb committed Aug 24, 2018
1 parent 4a10c19 commit ff4ad95
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions dask_jobqueue/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from distributed import LocalCluster
from distributed.deploy import Cluster
from distributed.diagnostics.plugin import SchedulerPlugin
from distributed.utils import (format_bytes, parse_bytes, tmpfile)
from distributed.utils import format_bytes, parse_bytes, tmpfile, get_ip_interface

logger = logging.getLogger(__name__)
docstrings = docrep.DocstringProcessor()
Expand Down Expand Up @@ -179,8 +179,6 @@ def __init__(self,
local_directory = dask.config.get('jobqueue.%s.local-directory' % self.scheduler_name)
if extra is None:
extra = dask.config.get('jobqueue.%s.extra' % self.scheduler_name)
if interface:
extra += ' --interface %s ' % interface
if env_extra is None:
env_extra = dask.config.get('jobqueue.%s.env-extra' % self.scheduler_name)

Expand All @@ -196,11 +194,16 @@ def __init__(self,
# This attribute should be overriden
self.job_header = None

# Bind to all network addresses by default
if 'ip' not in kwargs:
kwargs['ip'] = ''

self.local_cluster = LocalCluster(n_workers=0, **kwargs)
if interface:
extra += ' --interface %s ' % interface
kwargs.setdefault('ip', get_ip_interface(interface))
else:
kwargs.setdefault('ip', '')

# Bokeh diagnostics server should listen on all interfaces
diagnostics_ip_and_port = ('', 8787)
self.local_cluster = LocalCluster(n_workers=0, diagnostics_port=diagnostics_ip_and_port,
**kwargs)

# Keep information on process, threads and memory, for use in
# subclasses
Expand Down

0 comments on commit ff4ad95

Please sign in to comment.