[Python-modules-commits] [dask.distributed] 01/01: Add patch robustly-close-localcluster.patch and extend-to-asyncio.patch.

Diane Trout diane at moszumanska.debian.org
Thu Dec 21 22:19:25 UTC 2017


This is an automated email from the git hooks/post-receive script.

diane pushed a commit to annotated tag debian/1.20.2+ds.1-2
in repository dask.distributed.

commit b6ee0e1632ef8d7ff7cad2040489726c135032e7
Author: Diane Trout <diane at ghic.org>
Date:   Thu Dec 21 11:28:11 2017 -0800

    Add patch robustly-close-localcluster.patch and extend-to-asyncio.patch.
    
    These two patches fix autopkgtests failing because
    of cleanup problems.
---
 debian/changelog                                 |   9 ++
 debian/patches/extend-to-asyncio.patch           | 120 ++++++++++++++++
 debian/patches/robustly-close-localcluster.patch | 168 +++++++++++++++++++++++
 debian/patches/series                            |   2 +
 4 files changed, 299 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index b1d5988..e420431 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+dask.distributed (1.20.2+ds.1-2) unstable; urgency=medium
+
+  * Add patch robustly-close-localcluster.patch and
+    extend-to-asyncio.patch.
+    - These two patches fix autopkgtests failing because
+      of cleanup problems.
+
+ -- Diane Trout <diane at ghic.org>  Thu, 21 Dec 2017 11:27:35 -0800
+
 dask.distributed (1.20.2+ds.1-1) unstable; urgency=medium
 
   * New upstream release.
diff --git a/debian/patches/extend-to-asyncio.patch b/debian/patches/extend-to-asyncio.patch
new file mode 100644
index 0000000..2cb6a06
--- /dev/null
+++ b/debian/patches/extend-to-asyncio.patch
@@ -0,0 +1,120 @@
+From fe10ea16d639db8c2f910b72068fe49a7bedc178 Mon Sep 17 00:00:00 2001
+From: Matthew Rocklin <mrocklin at gmail.com>
+Date: Tue, 19 Dec 2017 17:11:41 -0500
+Subject: [PATCH] extend to asyncio tests
+
+---
+ distributed/tests/py3_test_asyncio.py | 77 +++++++++++++++++------------------
+ 1 file changed, 37 insertions(+), 40 deletions(-)
+
+--- a/distributed/tests/py3_test_asyncio.py
++++ b/distributed/tests/py3_test_asyncio.py
+@@ -49,18 +49,17 @@
+ 
+ @coro_test
+ async def test_asyncio_start_close():
+-    c = await AioClient(processes=False)
++    async with AioClient(processes=False) as c:
++        assert c.status == 'running'
++        # AioClient has installed its AioLoop shim.
++        assert isinstance(IOLoop.current(instance=False), BaseAsyncIOLoop)
++
++        result = await c.submit(inc, 10)
++        assert result == 11
+ 
+-    assert c.status == 'running'
+-    # AioClient has installed its AioLoop shim.
+-    assert isinstance(IOLoop.current(instance=False), BaseAsyncIOLoop)
+-
+-    result = await c.submit(inc, 10)
+-    assert result == 11
+-
+-    await c.close()
+-    assert c.status == 'closed'
+-    # assert IOLoop.current(instance=False) is None
++        await c.close()
++        assert c.status == 'closed'
++        # assert IOLoop.current(instance=False) is None
+ 
+ 
+ @coro_test
+@@ -317,22 +316,20 @@
+ @slow
+ @coro_test
+ async def test_asyncio_restart():
+-    c = await AioClient(processes=False)
++    async with AioClient(processes=False) as c:
++        assert c.status == 'running'
++        x = c.submit(inc, 1)
++        assert x.key in c.refcount
++
++        await c.restart()
++        assert x.key not in c.refcount
+ 
+-    assert c.status == 'running'
+-    x = c.submit(inc, 1)
+-    assert x.key in c.refcount
+-
+-    await c.restart()
+-    assert x.key not in c.refcount
+-
+-    key = x.key
+-    del x
+-    import gc
+-    gc.collect()
++        key = x.key
++        del x
++        import gc
++        gc.collect()
+ 
+-    assert key not in c.refcount
+-    await c.shutdown()
++        assert key not in c.refcount
+ 
+ 
+ @coro_test
+@@ -343,27 +340,27 @@
+ 
+ @coro_test
+ async def test_asyncio_variable():
+-    c = await AioClient(processes=False)
+-    s = c.cluster.scheduler
++    async with AioClient(processes=False) as c:
++        s = c.cluster.scheduler
+ 
+-    x = Variable('x')
+-    xx = Variable('x')
+-    assert x.client is c
++        x = Variable('x')
++        xx = Variable('x')
++        assert x.client is c
+ 
+-    future = c.submit(inc, 1)
++        future = c.submit(inc, 1)
+ 
+-    await x.set(future)
+-    future2 = await xx.get()
+-    assert future.key == future2.key
++        await x.set(future)
++        future2 = await xx.get()
++        assert future.key == future2.key
+ 
+-    del future, future2
++        del future, future2
+ 
+-    await asyncio.sleep(0.1)
+-    assert s.task_state  # future still present
++        await asyncio.sleep(0.1)
++        assert s.task_state  # future still present
+ 
+-    x.delete()
++        x.delete()
+ 
+-    start = time()
+-    while s.task_state:
+-        await asyncio.sleep(0.01)
+-        assert time() < start + 5
++        start = time()
++        while s.task_state:
++            await asyncio.sleep(0.01)
++            assert time() < start + 5
diff --git a/debian/patches/robustly-close-localcluster.patch b/debian/patches/robustly-close-localcluster.patch
new file mode 100644
index 0000000..5038c9e
--- /dev/null
+++ b/debian/patches/robustly-close-localcluster.patch
@@ -0,0 +1,168 @@
+From: Matthew Rocklin <mrocklin at gmail.com>
+Date: Tue, 19 Dec 2017 10:23:38 -0500
+Subject: [PATCH] Robustly close LocalCluster in tests
+Bug: https://github.com/dask/distributed/issues/1620#issuecomment-352788729
+
+diff --git a/distributed/deploy/tests/test_adaptive.py b/distributed/deploy/tests/test_adaptive.py
+index ce74002f7..aece1ae73 100644
+--- a/distributed/deploy/tests/test_adaptive.py
++++ b/distributed/deploy/tests/test_adaptive.py
+@@ -87,34 +87,36 @@ def test_adaptive_local_cluster_multi_workers():
+     loop = IOLoop.current()
+     cluster = LocalCluster(0, scheduler_port=0, silence_logs=False, processes=False,
+                            diagnostics_port=None, loop=loop, start=False)
+-    cluster.scheduler.allowed_failures = 1000
+-    alc = Adaptive(cluster.scheduler, cluster, interval=100)
+-    c = yield Client(cluster, asynchronous=True, loop=loop)
++    try:
++        cluster.scheduler.allowed_failures = 1000
++        alc = Adaptive(cluster.scheduler, cluster, interval=100)
++        c = yield Client(cluster, asynchronous=True, loop=loop)
+ 
+-    futures = c.map(slowinc, range(100), delay=0.01)
++        futures = c.map(slowinc, range(100), delay=0.01)
+ 
+-    start = time()
+-    while not cluster.scheduler.worker_info:
+-        yield gen.sleep(0.01)
+-        assert time() < start + 15
++        start = time()
++        while not cluster.scheduler.worker_info:
++            yield gen.sleep(0.01)
++            assert time() < start + 15
+ 
+-    yield c._gather(futures)
+-    del futures
++        yield c._gather(futures)
++        del futures
+ 
+-    start = time()
+-    while cluster.workers:
+-        yield gen.sleep(0.01)
+-        assert time() < start + 5
++        start = time()
++        while cluster.workers:
++            yield gen.sleep(0.01)
++            assert time() < start + 5
+ 
+-    assert not cluster.workers
+-    assert not cluster.scheduler.workers
+-    yield gen.sleep(0.2)
+-    assert not cluster.workers
+-    assert not cluster.scheduler.workers
++        assert not cluster.workers
++        assert not cluster.scheduler.workers
++        yield gen.sleep(0.2)
++        assert not cluster.workers
++        assert not cluster.scheduler.workers
+ 
+-    futures = c.map(slowinc, range(100), delay=0.01)
+-    yield c._gather(futures)
++        futures = c.map(slowinc, range(100), delay=0.01)
++        yield c._gather(futures)
+ 
+-    yield c._close()
+-    yield cluster._close()
++    finally:
++        yield c._close()
++        yield cluster._close()
+ 
+diff --git a/distributed/deploy/tests/test_local.py b/distributed/deploy/tests/test_local.py
+index 331a7ab41..6ae4da88f 100644
+--- a/distributed/deploy/tests/test_local.py
++++ b/distributed/deploy/tests/test_local.py
+@@ -36,17 +36,17 @@ def test_simple(loop):
+ 
+ 
+ def test_close_twice():
+-    cluster = LocalCluster()
+-    with Client(cluster.scheduler_address) as client:
+-        f = client.map(inc, range(100))
+-        client.gather(f)
+-    with captured_logger('tornado.application') as log:
+-        cluster.close()
+-        cluster.close()
+-        sleep(0.5)
+-    log = log.getvalue()
+-    print(log)
+-    assert not log
++    with LocalCluster() as cluster:
++        with Client(cluster.scheduler_address) as client:
++            f = client.map(inc, range(100))
++            client.gather(f)
++        with captured_logger('tornado.application') as log:
++            cluster.close()
++            cluster.close()
++            sleep(0.5)
++        log = log.getvalue()
++        print(log)
++        assert not log
+ 
+ 
+ @pytest.mark.skipif('sys.version_info[0] == 2', reason='multi-loop')
+diff --git a/distributed/tests/test_client.py b/distributed/tests/test_client.py
+index 91488a1b5..4de5a11a7 100644
+--- a/distributed/tests/test_client.py
++++ b/distributed/tests/test_client.py
+@@ -435,22 +435,19 @@ def test_thread(loop):
+ 
+ def test_sync_exceptions(loop):
+     with cluster() as (s, [a, b]):
+-        c = Client(s['address'], loop=loop)
+-
+-        x = c.submit(div, 10, 2)
+-        assert x.result() == 5
+-
+-        y = c.submit(div, 10, 0)
+-        try:
+-            y.result()
+-            assert False
+-        except ZeroDivisionError:
+-            pass
++        with Client(s['address'], loop=loop) as c:
++            x = c.submit(div, 10, 2)
++            assert x.result() == 5
+ 
+-        z = c.submit(div, 10, 5)
+-        assert z.result() == 2
++            y = c.submit(div, 10, 0)
++            try:
++                y.result()
++                assert False
++            except ZeroDivisionError:
++                pass
+ 
+-        c.close()
++            z = c.submit(div, 10, 5)
++            assert z.result() == 2
+ 
+ 
+ @gen_cluster(client=True)
+@@ -4857,17 +4854,17 @@ def test_quiet_quit_when_cluster_leaves(loop_in_thread):
+     from distributed import LocalCluster
+ 
+     loop = loop_in_thread
+-    cluster = LocalCluster(loop=loop, scheduler_port=0, diagnostics_port=None,
+-                           silence_logs=False)
+-    with captured_logger('distributed.comm') as sio:
+-        with Client(cluster, loop=loop) as client:
+-            futures = client.map(lambda x: x + 1, range(10))
+-            sleep(0.05)
+-            cluster.close()
+-            sleep(0.05)
++    with LocalCluster(loop=loop, scheduler_port=0, diagnostics_port=None,
++                      silence_logs=False) as cluster:
++        with captured_logger('distributed.comm') as sio:
++            with Client(cluster, loop=loop) as client:
++                futures = client.map(lambda x: x + 1, range(10))
++                sleep(0.05)
++                cluster.close()
++                sleep(0.05)
+ 
+-    text = sio.getvalue()
+-    assert not text
++        text = sio.getvalue()
++        assert not text
+ 
+ 
+ def test_warn_executor(loop):
diff --git a/debian/patches/series b/debian/patches/series
index f7703c3..cbb7aba 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,3 @@
 use-local-intersphinx-inventory.patch
+robustly-close-localcluster.patch
+extend-to-asyncio.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/dask.distributed.git



More information about the Python-modules-commits mailing list