Rate this Page
★ ★ ★ ★ ★

Events#

Created On: Oct 25, 2026 | Last Updated On: Oct 25, 2026

API Methods#

torch.distributed.elastic.events.record()[source]#
torch.distributed.elastic.events.construct_and_record_rdzv_event(run_id, message, node_state, name='', hostname='', pid=None, master_endpoint='', local_id=None, rank=None)[source]#

Initialize rendezvous event object and record its operations.

Parameters:
  • run_id (str) – The run id of the rendezvous.

  • message (str) – The message describing the event.

  • node_state (NodeState) – The state of the node (INIT, RUNNING, SUCCEEDED, FAILED).

  • name (str) – Event name. (E.g. Current action being performed).

  • hostname (str) – Hostname of the node.

  • pid (Optional[int]) – The process id of the node.

  • master_endpoint (str) – The master endpoint for the rendezvous store, if known.

  • local_id (Optional[int]) – The local_id of the node, if defined in dynamic_rendezvous.py

  • rank (Optional[int]) – The rank of the node, if known.

Returns:

None

Return type:

None

Example

>>> # See DynamicRendezvousHandler class
>>> def _record(
...     self,
...     message: str,
...     node_state: NodeState = NodeState.RUNNING,
...     rank: Optional[int] = None,
... ) -> None:
...     construct_and_record_rdzv_event(
...         name=f"{self.__class__.__name__}.{get_method_name()}",
...         run_id=self._settings.run_id,
...         message=message,
...         node_state=node_state,
...         hostname=self._this_node.addr,
...         pid=self._this_node.pid,
...         local_id=self._this_node.local_id,
...         rank=rank,
...     )
torch.distributed.elastic.events.get_logging_handler(destination='null')[source]#
Return type:

Handler

torch.distributed.elastic.events.record_rdzv_event(event)[source]#

Event Objects#

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

The class represents the generic event that occurs during the torchelastic job execution.

The event can be any kind of meaningful action.

Parameters:
  • name (str) – event name.

  • source (EventSource) – the event producer, e.g. agent or worker

  • timestamp (int) – timestamp in milliseconds when event occurred.

  • metadata (dict[str, str | int | float | bool | None]) – additional data that is associated with the event.

static deserialize(data)[source]#

Return a Event from a JSON string; Event inputs are returned as is.

Return type:

Event

serialize()[source]#

Return the event as a JSON string.

Return type:

str

class torch.distributed.elastic.events.api.EventSource(value)[source]#

Known identifiers of the event producers.

torch.distributed.elastic.events.api.EventMetadataValue#

alias of str | int | float | bool | None

class torch.distributed.elastic.events.api.NodeState(value)[source]#

The states that a node can be in rendezvous.

class torch.distributed.elastic.events.api.RdzvEvent(name, run_id, message, hostname, pid, node_state, master_endpoint='', rank=None, local_id=None, error_trace='')[source]#

Dataclass to represent any rendezvous event.

Parameters:
  • name (str) – Event name. (E.g. Current action being performed)

  • run_id (str) – The run id of the rendezvous

  • message (str) – The message describing the event

  • hostname (str) – Hostname of the node

  • pid (int) – The process id of the node

  • node_state (NodeState) – The state of the node (INIT, RUNNING, SUCCEEDED, FAILED)

  • master_endpoint (str) – The master endpoint for the rendezvous store, if known

  • rank (int | None) – The rank of the node, if known

  • local_id (int | None) – The local_id of the node, if defined in dynamic_rendezvous.py

  • error_trace (str) – Error stack trace, if this is an error event.

static deserialize(data)[source]#

Return a RdzvEvent from a JSON string; RdzvEvent inputs are returned as is.

Return type:

RdzvEvent

serialize()[source]#

Return the event as a JSON string.

Return type:

str