You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何为Dask调度器与Worker控制台日志启用时间戳?(指定版本)

Adding Timestamps to Dask Scheduler & Worker Logs (v0.15.0/1.17.1)

Absolutely! You can easily add timestamp prefixes to your Dask Scheduler and Worker logs—this is a fantastic help for debugging crash issues, since it lets you correlate events across components much more clearly. Here’s how to set this up for your specific version stack:

1. Command Line Flags (Quick, One-Time Setup)

When launching your Scheduler or Workers directly via the command line, use the --log-format flag to define a logging template that includes timestamps:

For the Scheduler:

dask-scheduler --log-format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'

For Workers:

dask-worker tcp://192.168.200.23:8600 --log-format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'

2. Configuration File (Persistent, Global Setup)

If you want timestamped logs to be the default for all your Dask runs, add the logging format to your dask_config.yaml file:

distributed:
  logging:
    format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
    # Optional: Customize the timestamp format (default is '%Y-%m-%d %H:%M:%S,%f')
    datefmt: '%Y-%m-%d %H:%M:%S'

Example of Timestamped Logs

After applying either method, your logs will look like this (with timestamps frontloaded):

2024-05-20 14:45:30 - distributed.scheduler - INFO - Register tcp://192.168.200.23:33876
2024-05-20 14:45:31 - distributed.worker - INFO - Start worker at: tcp://192.168.200.23:33876

The %(asctime)s placeholder inserts the timestamp, and you can tweak the datefmt value to match your preferred format (e.g., add milliseconds with %f if needed).

内容的提问来源于stack exchange,提问作者B Jacob

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 04:24:38