Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions runx/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import yaml
import shlex
import json
import logging
from warnings import warn

import subprocess
Expand All @@ -49,6 +50,7 @@ def exec_cmd(cmd):
print(message)


logger = logging.getLogger(__name__)
trn_names = ('trn', 'train', 'training')
val_names = ('val', 'validate', 'validation', 'test')

Expand All @@ -75,6 +77,7 @@ def read_config_file(args=None):
home = os.path.expanduser('~')
global_config_fn = '{}/.config/runx.yml'.format(home)

global_config = {"LOGROOT": os.path.join(home, '.cache/runx')}
if args is not None and hasattr(args, 'config_file') and \
args.config_file is not None and \
os.path.isfile(args.config_file):
Expand All @@ -84,8 +87,10 @@ def read_config_file(args=None):
elif os.path.exists(global_config_fn):
config_fn = global_config_fn
else:
raise('can\'t find file ./.runx or ~/.config/runx.yml config files')
if 'FullLoader' in dir(yaml):
config_fn = None
if config_fn is None:
logger.info("No runx config, use default.")
elif 'FullLoader' in dir(yaml):
global_config = yaml.load(open(config_fn), Loader=yaml.SafeLoader)
else:
global_config = yaml.safe_load(open(config_fn))
Expand Down