class_docstr: Environment for fault-tolerant and elastic training with `torchelastic <https://pytorch.org/elastic/>`_
class_docstr_tok: ["Environment","for","fault-tolerant","and","elastic","training","with","`","torchelastic","<","https",":","\/\/pytorch.org\/elastic\/",">","`","_"]
code: def main_address(self) -> str:
      if "MASTER_ADDR" not in os.environ:
          rank_zero_warn(
              "MASTER_ADDR environment variable is not defined. Set as localhost"
          )
          os.environ["MASTER_ADDR"] = "127.0.0.1"
      log.debug(f"MASTER_ADDR: {os.environ['MASTER_ADDR']}")
      return os.environ["MASTER_ADDR"]
  
file_path: pytorch-lightning/src/lightning/fabric/plugins/environments/torchelastic.py
imports: import logging
  import os
  import torch.distributed
  from typing_extensions import override
  from lightning.fabric.plugins.environments.cluster_environment import ClusterEnvironment
  from lightning.fabric.utilities.rank_zero import rank_zero_warn
label_desc: Use image node_id 2 for calling the TorchElasticEnvironment obj's underlying member method code with example usage: obj.main_address() and returns: os