-
Notifications
You must be signed in to change notification settings - Fork 22
/
conftest.py
37 lines (29 loc) · 1.04 KB
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
# PMDA
# Copyright (c) 2017 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#
# Released under the GNU Public Licence, v2 or any higher version
from dask import distributed
import dask
import pytest
@pytest.fixture(scope="session", params=(1, 2))
def client(tmpdir_factory, request):
with tmpdir_factory.mktemp("dask_cluster").as_cwd():
lc = distributed.LocalCluster(n_workers=request.param, processes=True)
client = distributed.Client(lc)
yield client
client.close()
lc.close()
@pytest.fixture(scope='session', params=('distributed',
'processes',
'synchronous'))
def scheduler(request, client):
if request.param == 'distributed':
arg = client
else:
arg = request.param
with dask.config.set(scheduler=arg):
yield