diff -Nru dask.distributed-1.20.2+ds.1/debian/changelog dask.distributed-1.20.2+ds.1/debian/changelog --- dask.distributed-1.20.2+ds.1/debian/changelog 2017-10-13 03:56:29.000000000 +0000 +++ dask.distributed-1.20.2+ds.1/debian/changelog 2017-12-21 19:27:35.000000000 +0000 @@ -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 Thu, 21 Dec 2017 11:27:35 -0800 + dask.distributed (1.20.2+ds.1-1) unstable; urgency=medium * New upstream release. diff -Nru dask.distributed-1.20.2+ds.1/debian/patches/extend-to-asyncio.patch dask.distributed-1.20.2+ds.1/debian/patches/extend-to-asyncio.patch --- dask.distributed-1.20.2+ds.1/debian/patches/extend-to-asyncio.patch 1970-01-01 00:00:00.000000000 +0000 +++ dask.distributed-1.20.2+ds.1/debian/patches/extend-to-asyncio.patch 2017-12-19 22:21:05.000000000 +0000 @@ -0,0 +1,120 @@ +From fe10ea16d639db8c2f910b72068fe49a7bedc178 Mon Sep 17 00:00:00 2001 +From: Matthew Rocklin +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 -Nru dask.distributed-1.20.2+ds.1/debian/patches/robustly-close-localcluster.patch dask.distributed-1.20.2+ds.1/debian/patches/robustly-close-localcluster.patch --- dask.distributed-1.20.2+ds.1/debian/patches/robustly-close-localcluster.patch 1970-01-01 00:00:00.000000000 +0000 +++ dask.distributed-1.20.2+ds.1/debian/patches/robustly-close-localcluster.patch 2017-12-19 19:02:34.000000000 +0000 @@ -0,0 +1,168 @@ +From: Matthew Rocklin +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 -Nru dask.distributed-1.20.2+ds.1/debian/patches/series dask.distributed-1.20.2+ds.1/debian/patches/series --- dask.distributed-1.20.2+ds.1/debian/patches/series 2017-07-28 23:02:57.000000000 +0000 +++ dask.distributed-1.20.2+ds.1/debian/patches/series 2017-12-19 22:17:48.000000000 +0000 @@ -1 +1,3 @@ use-local-intersphinx-inventory.patch +robustly-close-localcluster.patch +extend-to-asyncio.patch