diff --git a/distributed/tests/test_worker.py b/distributed/tests/test_worker.py index b6b04c9969e..9b6314a3d74 100644 --- a/distributed/tests/test_worker.py +++ b/distributed/tests/test_worker.py @@ -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) diff --git a/distributed/worker_memory.py b/distributed/worker_memory.py index c75801732da..4a67d751c77 100644 --- a/distributed/worker_memory.py +++ b/distributed/worker_memory.py @@ -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: