def detect() -> bool:
        """Returns ``True`` if the current process was launched using the torchelastic command."""
        # if not available (for example on MacOS), `is_torchelastic_launched` is not defined
        return torch.distributed.is_available() and torch.distributed.is_torchelastic_launched()
Returns ``True`` if the current process was launched using the torchelastic command.
src/lightning/fabric/plugins/environments/torchelastic.py