From 73fa9bd1bd7dcb4ceed72cdbdc6dd4b92f887521 Mon Sep 17 00:00:00 2001 From: Matthew Rocklin Date: Wed, 2 Sep 2020 11:52:43 -0700 Subject: [PATCH] Log when downloading a preload script (#4094) --- distributed/preloading.py | 1 + distributed/tests/test_preload.py | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/distributed/preloading.py b/distributed/preloading.py index f1e125b7b13..b3d6a8e6d13 100644 --- a/distributed/preloading.py +++ b/distributed/preloading.py @@ -120,6 +120,7 @@ def _import_module(name, file_dir=None) -> ModuleType: async def _download_module(url: str) -> ModuleType: + logger.info("Downloading preload at %s", url) assert is_webaddress(url) client = AsyncHTTPClient() diff --git a/distributed/tests/test_preload.py b/distributed/tests/test_preload.py index 2c35a59e06c..989e3d629ae 100644 --- a/distributed/tests/test_preload.py +++ b/distributed/tests/test_preload.py @@ -9,7 +9,7 @@ import dask from distributed import Client, Scheduler, Worker, Nanny -from distributed.utils_test import cluster +from distributed.utils_test import cluster, captured_logger from distributed.utils_test import loop, cleanup # noqa F401 @@ -139,7 +139,9 @@ def dask_setup(dask_server): app = web.Application([(r"/preload", MyHandler)]) server = app.listen(12345) try: - async with Scheduler(preload=["http://localhost:12345/preload"]) as s: - assert s.foo == 1 + with captured_logger("distributed.preloading") as log: + async with Scheduler(preload=["http://localhost:12345/preload"]) as s: + assert s.foo == 1 + assert "12345/preload" in log.getvalue() finally: server.stop()