add log_path flag to command line utility (#917)

* add log_path flag to command line utility

* Update README with log_path flag

* clarify logg and viz docs
This commit is contained in:
albert
2019-06-07 15:05:52 -07:00
committed by pzhokhov
parent 7c520852d9
commit ba2b017820
4 changed files with 25 additions and 6 deletions

View File

@@ -192,6 +192,12 @@ def parse_cmdline_kwargs(args):
return {k: parse(v) for k,v in parse_unknown_args(args).items()}
def configure_logger(log_path, **kwargs):
if log_path is not None:
logger.configure(log_path)
else:
logger.configure(**kwargs)
def main(args):
# configure logger, disable logging in child MPI processes (with rank > 0)
@@ -202,10 +208,10 @@ def main(args):
if MPI is None or MPI.COMM_WORLD.Get_rank() == 0:
rank = 0
logger.configure()
configure_logger(args.log_path)
else:
logger.configure(format_strs=[])
rank = MPI.COMM_WORLD.Get_rank()
configure_logger(args.log_path, format_strs=[])
model, env = train(args, extra_args)