def rllab_logdir(algo=None, dirname=None): if dirname: rllablogger.set_snapshot_dir(dirname) dirname = rllablogger.get_snapshot_dir() rllablogger.add_tabular_output(os.path.join(dirname, 'progress.csv')) if algo: with open(os.path.join(dirname, 'params.json'), 'w') as f: params = extract_hyperparams(algo) json.dump(params, f) yield dirname rllablogger.remove_tabular_output(os.path.join(dirname, 'progress.csv'))