Skip to content

Commit

Permalink
Log when downloading a preload script (#4094)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrocklin authored Sep 2, 2020
1 parent 0333b9a commit 73fa9bd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions distributed/preloading.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
8 changes: 5 additions & 3 deletions distributed/tests/test_preload.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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()

0 comments on commit 73fa9bd

Please sign in to comment.