gigl.distributed.utils.sampling_errors#
Wire format for forwarding a sampling-worker exception to the training loop.
A GLT SampleMessage is a dict[str, torch.Tensor]. We reserve one #-prefixed
key (matching GLT’s #IS_HETERO / #META. convention) to carry a UTF-8 traceback
encoded as a uint8 tensor, so a failed sampling coroutine can surface as a fast, explained
error on the consumer instead of a silent hang.
Attributes#
Functions#
|
Encode a traceback string as a writable 1-D uint8 tensor. |
Raise |
Module Contents#
- gigl.distributed.utils.sampling_errors.encode_sampling_error(traceback_str)[source]#
Encode a traceback string as a writable 1-D uint8 tensor.
Uses
bytearrayso the backing buffer is writable (torch.frombufferwarns on read-only buffers and raises on empty ones); a single sentinel byte represents the empty string so the tensor is never zero-length.- Parameters:
traceback_str (str) – The traceback text to transport.
- Returns:
A 1-D
torch.uint8tensor holding the UTF-8 bytes.- Return type:
torch.Tensor
- gigl.distributed.utils.sampling_errors.raise_if_sampling_error(msg)[source]#
Raise
RuntimeErrorwith the embedded traceback ifmsgis a poison pill.No-op when the reserved key is absent.
- Parameters:
msg (graphlearn_torch.channel.SampleMessage) – A received
SampleMessage.- Raises:
RuntimeError – If
msgcarries a sampling-error payload.- Return type:
None