Skip to content

Commit 594bbfa

Browse files
AbishekSfacebook-github-bot
authored andcommitted
Make it possible for users to disable .torchxconfig (meta-pytorch#1125)
Summary: X-link: meta-pytorch#1125 So that the one below is valid and does not use any configs ``` TORCHXCONFIG="" torchx run ``` Reviewed By: kiukchung Differential Revision: D83086473
1 parent b72ba03 commit 594bbfa

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

torchx/runner/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,8 @@ def find_configs(dirs: Optional[Iterable[str]] = None) -> List[str]:
494494

495495
config = os.getenv(ENV_TORCHXCONFIG)
496496
if config is not None:
497+
if not config:
498+
return []
497499
configfile = Path(config)
498500
if not configfile.is_file():
499501
raise FileNotFoundError(

torchx/runner/test/config_test.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,12 @@ def test_get_configs(self) -> None:
275275
),
276276
)
277277

278+
def test_no_config(self) -> None:
279+
config_dir = self.tmpdir
280+
with patch.dict(os.environ, {ENV_TORCHXCONFIG: str("")}):
281+
configs = find_configs(dirs=[str(config_dir)])
282+
self.assertEqual([], configs)
283+
278284
def test_find_configs(self) -> None:
279285
config_dir = self.tmpdir
280286
cwd_dir = config_dir / "cwd"

0 commit comments

Comments
 (0)