Skip to content

Commit

Permalink
(torchx/cli) load .torchxconfig file from HOME -> CWD for cmd_run (#378)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Kiuk Chung authored and facebook-github-bot committed Jan 31, 2022
1 parent 9d8c74d commit ad4430b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions torchx/cli/cmd_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import sys
import threading
from dataclasses import asdict
from pathlib import Path
from pprint import pformat
from typing import Dict, List, Optional, Tuple, Type

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

config_files = config.find_configs()
config.apply(scheduler=args.scheduler, cfg=cfg, dirs=config_dirs)

config_files = config.find_configs(dirs=config_dirs)
workspace = (
"file://" + os.path.dirname(config_files[0]) if config_files else None
)

component, component_args = _parse_component_name_and_args(
args.component_name_and_args,
none_throws(self._subparser),
dirs=config_dirs,
)

try:
Expand Down

0 comments on commit ad4430b

Please sign in to comment.