Shortcuts

事件

模块包含与标准Python日志记录集成的事件处理机制。

使用示例:

from torch.distributed.elastic import events
event = events.Event(name="test_event", source=events.EventSource.WORKER, metadata={...})
events.get_logging_handler(destination="console").info(event)

API 方法

torch.distributed.elastic.events.record(event, destination='null')[源代码]
torch.distributed.elastic.events.get_logging_handler(destination='null')[源代码]
Return type

处理器

事件对象

class torch.distributed.elastic.events.api.Event(name, source, timestamp=0, metadata=<factory>)[源代码]

该类表示在torchelastic作业执行期间发生的通用事件。

该事件可以是任何有意义的行为。

Parameters
  • 名称 (str) – 事件名称。

  • (EventSource) – 事件生产者,例如代理或工作节点

  • 时间戳 (int) – 事件发生时的时间戳,单位为毫秒。

  • 元数据 (Dict[str, Optional[Union[str, int, float, bool]]]) – 与事件关联的附加数据。

class torch.distributed.elastic.events.api.EventSource(value)[源代码]

事件生产者的已知标识符。

torch.distributed.elastic.events.api.EventMetadataValue

的别名 Optional[Union[str, int, float, bool]]