Skip to content

Commit

Permalink
Merge pull request #48 from mrocklin/config
Browse files Browse the repository at this point in the history
Add configuration file
  • Loading branch information
Joe Hamman committed May 17, 2018
2 parents 8c50e3f + 01cbdc4 commit 24d1343
Show file tree
Hide file tree
Showing 14 changed files with 87 additions and 24 deletions.
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
recursive-include dask_jobqueue *.py
recursive-include dask_jobqueue *.yaml

include LICENSE.txt
include README.rst

Expand Down
2 changes: 2 additions & 0 deletions ci/none.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ function jobqueue_before_install {
./ci/conda_setup.sh
export PATH="$HOME/miniconda/bin:$PATH"
conda install --yes -c conda-forge python=$TRAVIS_PYTHON_VERSION dask distributed flake8 pytest docrep
pip install --no-cache-dir git+https://github.com/dask/dask.git --upgrade --no-deps
pip install --no-cache-dir git+https://github.com/dask/distributed.git --upgrade --no-deps
}

function jobqueue_install {
Expand Down
2 changes: 2 additions & 0 deletions ci/pbs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ RUN curl -o miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-latest-L
/opt/anaconda/bin/conda clean -tipy && \
rm -f miniconda.sh
RUN conda install --yes -c conda-forge python=3.6 dask distributed flake8 pytest docrep
RUN pip install --no-cache-dir git+https://github.com/dask/dask.git --upgrade --no-deps
RUN pip install --no-cache-dir git+https://github.com/dask/distributed.git --upgrade --no-deps

# Copy entrypoint and other needed scripts
COPY ./*.sh /
Expand Down
2 changes: 2 additions & 0 deletions ci/sge/Dockerfile-master
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ ENV PATH /opt/anaconda/bin:$PATH
RUN conda install -n root conda=4.4.11 && conda clean -tipy
RUN conda install -c conda-forge dask distributed blas pytest mock ipython pip psutil && conda clean -tipy
RUN pip install --no-cache-dir drmaa
RUN pip install --no-cache-dir git+https://github.com/dask/dask.git --upgrade --no-deps
RUN pip install --no-cache-dir git+https://github.com/dask/distributed.git --upgrade --no-deps

COPY ./*.sh /
COPY ./*.txt /
Expand Down
2 changes: 2 additions & 0 deletions ci/sge/Dockerfile-slave
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ ENV PATH /opt/anaconda/bin:$PATH
RUN conda install -n root conda=4.4.11 && conda clean -tipy
RUN conda install -c conda-forge dask distributed blas pytest mock ipython pip psutil && conda clean -tipy
RUN pip install --no-cache-dir drmaa
RUN pip install --no-cache-dir git+https://github.com/dask/dask.git --upgrade --no-deps
RUN pip install --no-cache-dir git+https://github.com/dask/distributed.git --upgrade --no-deps

COPY ./setup-slave.sh /
COPY ./*.sh /
Expand Down
2 changes: 2 additions & 0 deletions ci/slurm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ RUN curl -o miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-latest-L
rm -f miniconda.sh
ENV PATH /opt/anaconda/bin:$PATH
RUN conda install --yes -c conda-forge python=3.6 dask distributed flake8 pytest docrep
RUN pip install --no-cache-dir git+https://github.com/dask/dask.git --upgrade --no-deps
RUN pip install --no-cache-dir git+https://github.com/dask/distributed.git --upgrade --no-deps

ENV LC_ALL en_US.UTF-8

Expand Down
1 change: 1 addition & 0 deletions dask_jobqueue/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# flake8: noqa
from . import config
from .core import JobQueueCluster
from .pbs import PBSCluster
from .slurm import SLURMCluster
Expand Down
15 changes: 15 additions & 0 deletions dask_jobqueue/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from __future__ import print_function, division, absolute_import

import os

import dask
import yaml


fn = os.path.join(os.path.dirname(__file__), 'jobqueue.yaml')
dask.config.ensure_file(source=fn)

with open(fn) as f:
defaults = yaml.load(f)

dask.config.update(dask.config.config, defaults, priority='old')
19 changes: 10 additions & 9 deletions dask_jobqueue/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import sys
from contextlib import contextmanager

import dask
import docrep
from distributed import LocalCluster
from distributed.deploy import Cluster
Expand Down Expand Up @@ -78,15 +79,15 @@ class JobQueueCluster(Cluster):
cancel_command = None

def __init__(self,
name='dask-worker',
threads=2,
processes=4,
memory='8GB',
interface=None,
death_timeout=60,
local_directory=None,
extra='',
env_extra=[],
name=dask.config.get('jobqueue.name'),
threads=dask.config.get('jobqueue.threads'),
processes=dask.config.get('jobqueue.processes'),
memory=dask.config.get('jobqueue.memory'),
interface=dask.config.get('jobqueue.interface'),
death_timeout=dask.config.get('jobqueue.death-timeout'),
local_directory=dask.config.get('jobqueue.local-directory'),
extra=dask.config.get('jobqueue.extra'),
env_extra=dask.config.get('jobqueue.env-extra'),
**kwargs
):
""" """
Expand Down
26 changes: 26 additions & 0 deletions dask_jobqueue/jobqueue.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
jobqueue:
name: dask-worker
threads: 2
processes: 4
memory: 8GB
interface: null
death-timeout: 60
local-directory: null
extra: ""
env-extra: []

queue: null
project: null
walltime: '00:30:00'

pbs:
resource-spec: null
job-extra: []

sge:
resource-spec: null

slurm:
job-cpu: null
job-mem: null
job-extra: {}
12 changes: 7 additions & 5 deletions dask_jobqueue/pbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import math
import os

import dask

from .core import JobQueueCluster, docstrings

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -58,11 +60,11 @@ class PBSCluster(JobQueueCluster):
cancel_command = 'qdel'

def __init__(self,
queue=None,
project=None,
resource_spec=None,
walltime='00:30:00',
job_extra=[],
queue=dask.config.get('jobqueue.queue'),
project=dask.config.get('jobqueue.project'),
resource_spec=dask.config.get('jobqueue.pbs.resource-spec'),
walltime=dask.config.get('jobqueue.walltime'),
job_extra=dask.config.get('jobqueue.pbs.job-extra'),
**kwargs):

# Instantiate args and parameters from parent abstract class
Expand Down
10 changes: 6 additions & 4 deletions dask_jobqueue/sge.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import logging

import dask

from .core import JobQueueCluster, docstrings

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -42,10 +44,10 @@ class SGECluster(JobQueueCluster):
cancel_command = 'qdel'

def __init__(self,
queue=None,
project=None,
resource_spec=None,
walltime='0:30:00',
queue=dask.config.get('jobqueue.queue'),
project=dask.config.get('jobqueue.project'),
resource_spec=dask.config.get('jobqueue.sge.resource-spec'),
walltime=dask.config.get('jobqueue.walltime'),
**kwargs):

super(SGECluster, self).__init__(**kwargs)
Expand Down
14 changes: 8 additions & 6 deletions dask_jobqueue/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import os
import sys

import dask

from .core import JobQueueCluster, docstrings

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -58,12 +60,12 @@ class SLURMCluster(JobQueueCluster):
cancel_command = 'scancel'

def __init__(self,
queue=None,
project=None,
walltime='00:30:00',
job_cpu=None,
job_mem=None,
job_extra=[],
queue=dask.config.get('jobqueue.queue'),
project=dask.config.get('jobqueue.project'),
walltime=dask.config.get('jobqueue.walltime'),
job_cpu=dask.config.get('jobqueue.slurm.job-cpu'),
job_mem=dask.config.get('jobqueue.slurm.job-mem'),
job_extra=dask.config.get('jobqueue.slurm.job-extra'),
**kwargs):

super(SLURMCluster, self).__init__(**kwargs)
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
url='https://github.com/dask/dask-jobqueue',
license='BSD 3-Clause',
packages=['dask_jobqueue'],
include_package_data=True,
install_requires=install_requires,
tests_require=['pytest >= 2.7.1'],
long_description=long_description,
Expand Down

0 comments on commit 24d1343

Please sign in to comment.