Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix distributed tests on upstream-dev #3989

Merged
merged 2 commits into from
Apr 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ Internal Changes
- Add a CI job that runs the tests with every optional dependency
except ``dask``. (:issue:`3794`, :pull:`3919`)
By `Justus Magin <https://github.com/keewis>`_.

- Use ``async`` / ``await`` for the asynchronous distributed
tests. (:issue:`3987`, :pull:`3989`)
By `Justus Magin <https://github.com/keewis>`_.

.. _whats-new.0.15.1:

Expand Down
8 changes: 4 additions & 4 deletions xarray/tests/test_distributed.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def test_dask_distributed_cfgrib_integration_test(loop):
reason="Need recent distributed version to clean up get",
)
@gen_cluster(client=True, timeout=None)
def test_async(c, s, a, b):
async def test_async(c, s, a, b):
x = create_test_data()
assert not dask.is_dask_collection(x)
y = x.chunk({"dim2": 4}) + 10
Expand All @@ -206,7 +206,7 @@ def test_async(c, s, a, b):
assert futures_of(z)

future = c.compute(z)
w = yield future
w = await future
assert not dask.is_dask_collection(w)
assert_allclose(x + 10, w)

Expand All @@ -218,7 +218,7 @@ def test_hdf5_lock():


@gen_cluster(client=True)
def test_serializable_locks(c, s, a, b):
async def test_serializable_locks(c, s, a, b):
def f(x, lock=None):
with lock:
return x + 1
Expand All @@ -233,7 +233,7 @@ def f(x, lock=None):
]:

futures = c.map(f, list(range(10)), lock=lock)
yield c.gather(futures)
await c.gather(futures)

lock2 = pickle.loads(pickle.dumps(lock))
assert type(lock) == type(lock2)