Rate this Page
★ ★ ★ ★ ★

Utilities#

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

torch.distributed.elastic.utils.api.get_env_variable_or_raise(env_name)[source]#

Tries to retrieve environment variable. Raises ValueError if no environment variable found.

Parameters:

env_name (str) – Name of the env variable

Return type:

str

torch.distributed.elastic.utils.distributed.get_free_port()[source]#
torch.distributed.elastic.utils.log_level.get_log_level()[source]#

Return default log level for pytorch.

Return type:

str

torch.distributed.elastic.utils.logging.get_logger(name=None)[source]#

Util function to set up a simple logger that writes into stderr. The loglevel is fetched from the LOGLEVEL env. variable or WARNING as default. The function will use the module name of the caller if no name is provided.

Parameters:

name (str | None) – Name of the logger. If no name provided, the name will be derived from the call stack.

Return type:

Logger