Skip to content

Commit ad4430b

Browse files
Kiuk Chungfacebook-github-bot
authored andcommitted
(torchx/cli) load .torchxconfig file from HOME -> CWD for cmd_run (#378)
Summary: Pull Request resolved: #378 Adds `$HOME` to the list of dirs where we search for .torchxconfig. $HOME/.torchxconfig takes precedence over $CWD/.torchxconfig Reviewed By: d4l3k Differential Revision: D33858048 fbshipit-source-id: 31e7bb6fcaf80d9ea9bfe1b1f031224d2b021660
1 parent 9d8c74d commit ad4430b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

torchx/cli/cmd_run.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import sys
1111
import threading
1212
from dataclasses import asdict
13+
from pathlib import Path
1314
from pprint import pformat
1415
from typing import Dict, List, Optional, Tuple, Type
1516

@@ -196,15 +197,19 @@ def _run(self, runner: Runner, args: argparse.Namespace) -> None:
196197
run_opts = runner.run_opts()
197198
scheduler_opts = run_opts[args.scheduler]
198199
cfg = _parse_run_config(args.scheduler_args, scheduler_opts)
199-
config.apply(scheduler=args.scheduler, cfg=cfg)
200+
config_dirs = [str(Path.home()), str(Path.cwd())]
200201

201-
config_files = config.find_configs()
202+
config.apply(scheduler=args.scheduler, cfg=cfg, dirs=config_dirs)
203+
204+
config_files = config.find_configs(dirs=config_dirs)
202205
workspace = (
203206
"file://" + os.path.dirname(config_files[0]) if config_files else None
204207
)
208+
205209
component, component_args = _parse_component_name_and_args(
206210
args.component_name_and_args,
207211
none_throws(self._subparser),
212+
dirs=config_dirs,
208213
)
209214

210215
try:

0 commit comments

Comments
 (0)