简体   繁体   中英

How to silence a specific dask warning?

When I run my dask workers I gather useful information from them through the logs, but occasionally the logs get absolutely flooded with an error regarding unmanaged memory. Specifically this error fills the logs and makes any other issue un-fixable:

WARNING - 2023-01-01 00:00:00 - distributed.worker_memory._maybe_spill.l243 - Unmanaged memory use is high. This may indicate a memory leak or the memory may not be released to the OS; see https://distributed.dask.org/en/latest/worker-memory.html#memory-not-released-back-to-the-os for more information. -- Unmanaged memory: X GiB -- Worker memory limit: Y GiB

I have adjusted the log level in the yaml file to suppress anything below error level, but I do want to keep some normal information/warning level logs. Is there a way to filter this specific warning from the logs?

Thanks.

It depends on how you are implementing the workflow, but one option might be to suppress all warnings around the problematic part of the code (if you know where it occurs):

from warnings import catch_warnings

with catch_warnings():
   ...  # relevant code

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM