Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fjetter committed Oct 19, 2022
1 parent b88bd21 commit dc3dd47
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions distributed/tests/test_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -3721,3 +3721,21 @@ async def test_deprecation_of_renamed_worker_attributes(s, a, b):
)
with pytest.warns(DeprecationWarning, match=msg):
assert a.outgoing_current_count == a.transfer_outgoing_count


@gen_cluster(nthreads=[])
async def test_worker_log_memory_limit_too_high(s):
with captured_logger("distributed.worker_memory") as caplog:
# caplog.set_level(logging.WARN, logger="distributed.worker")
async with Worker(s.address, memory_limit="1PB"):
pass

expected_snippets = [
("ignore", "ignoring"),
("memory limit", "memory_limit"),
("system"),
("1PB"),
]
for snippets in expected_snippets:
# assert any(snip in caplog.text for snip in snippets)
assert any(snip in caplog.getvalue().lower() for snip in snippets)
2 changes: 1 addition & 1 deletion distributed/worker_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ def parse_memory_limit(
logger.warning(
"Ignoring provided memory limit %s due to system memory limit of %s",
orig,
system.MEMORY_LIMIT,
format_bytes(system.MEMORY_LIMIT),
)
return system.MEMORY_LIMIT
else:
Expand Down

0 comments on commit dc3dd47

Please sign in to comment.