def show(args, _config, _extra_args):
"""Show details about an experiment."""
import pickle
import pprint
name = args.name
with shelve.open('.em') as emdb:
if name not in emdb or name == EM_KEY:
return _die(E_NO_EXP.format(name))
for info_name, info_val in sorted(emdb[name].items()):
if isinstance(info_val, datetime.date):
info_val = info_val.ctime()
print(f'{info_name}: {info_val}')
if not args.opts:
return
opts_path = _expath(name, 'run', 'opts.pkl')
with open(opts_path, 'rb') as f_opts:
print('\noptions:')
opts = pickle.load(f_opts)
cols = shutil.get_terminal_size((80, 20)).columns
pprint.pprint(vars(opts), indent=2, compact=True, width=cols)
评论列表
文章目录