简体   繁体   English

如何使特定的 dask 警告静音?

[英]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:当我运行我的 dask worker 时,我通过日志从他们那里收集有用的信息,但偶尔日志会被关于 unmanaged memory 的错误完全淹没。具体来说,这个错误会填满日志并使任何其他问题无法修复:

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.我已经调整了 yaml 文件中的日志级别以抑制任何低于错误级别的内容,但我确实想保留一些正常信息/警告级别的日志。 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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