(key: str, new_value: str)
| 147 | |
| 148 | |
| 149 | def _check_env_variable(key: str, new_value: str): |
| 150 | # Only check for difference with preset environment variables |
| 151 | if key in os.environ and os.environ[key] != new_value: |
| 152 | raise RuntimeError( |
| 153 | f"Cannot export environment variables as {key} is already set" |
| 154 | ) |
| 155 | |
| 156 | |
| 157 | class _TorchDistributedEnvironment: |