From 7a7c6e53c81826c7cf6abb357cab9dcd50d60062 Mon Sep 17 00:00:00 2001 From: Eugene Vinitsky Date: Thu, 6 Dec 2018 15:52:44 -0800 Subject: [PATCH] [tune/rllib] Use cloudpickle to dump config (#3462) ## What do these changes do? JSON Logger now uses cloudpickle to dump the configs as welll, which pkls the functions needed for multi-agent replay. ## Related issue number --- python/ray/tune/logger.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python/ray/tune/logger.py b/python/ray/tune/logger.py index d2c79e6d8..183ba6490 100644 --- a/python/ray/tune/logger.py +++ b/python/ray/tune/logger.py @@ -9,6 +9,7 @@ import numpy as np import os import yaml +import ray.cloudpickle as cloudpickle from ray.tune.log_sync import get_syncer from ray.tune.result import NODE_IP, TRAINING_ITERATION, TIME_TOTAL_S, \ TIMESTEPS_TOTAL @@ -103,6 +104,9 @@ class _JsonLogger(Logger): indent=2, sort_keys=True, cls=_SafeFallbackEncoder) + config_pkl = os.path.join(self.logdir, "params.pkl") + with open(config_pkl, "wb") as f: + cloudpickle.dump(self.config, f) local_file = os.path.join(self.logdir, "result.json") self.local_out = open(local_file, "w")