Skip to content

Commit

Permalink
Inherit from distributed.deploy.Cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
mrocklin committed Mar 27, 2018
1 parent 3ea2dad commit 3d5b6a5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 18 deletions.
19 changes: 2 additions & 17 deletions dask_jobqueue/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from distributed.utils import tmpfile, ignoring, get_ip_interface, parse_bytes
from distributed import LocalCluster
from distributed.deploy import Cluster

dirname = os.path.dirname(sys.executable)

Expand All @@ -16,7 +17,7 @@


@docstrings.get_sectionsf('JobQueueCluster')
class JobQueueCluster(object):
class JobQueueCluster(Cluster):
""" Base class to launch Dask Clusters for Job queues
This class should not be used directly, use inherited class appropriate
Expand Down Expand Up @@ -153,10 +154,6 @@ def start_workers(self, n=1):
def scheduler(self):
return self.cluster.scheduler

@property
def scheduler_address(self):
return self.cluster.scheduler_address

def _calls(self, cmds):
""" Call a command using subprocess.communicate
Expand Down Expand Up @@ -223,15 +220,3 @@ def __enter__(self):
def __exit__(self, type, value, traceback):
self.stop_workers(self.jobs)
self.cluster.__exit__(type, value, traceback)

def adapt(self):
""" Start up an Adaptive deployment if not already started
This makes the cluster request resources in accordance to current
demand on the scheduler """
from distributed.deploy import Adaptive
if self._adaptive:
return
else:
self._adaptive = Adaptive(self.scheduler, self, startup_cost=5,
key=lambda ws: ws.host)
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
distributed>=1.21.3
docrep
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
url='https://github.com/dask/dask-jobqueue',
license='BSD 3-Clause',
packages=['dask_jobqueue'],
install_requires=open('requirements.txt').read().strip().split('\n'),
long_description=(open('README.rst').read() if exists('README.rst') else ''),
install_requires=['docrep'],
zip_safe=False)

0 comments on commit 3d5b6a5

Please sign in to comment.