[rllib] Replace ray.get() with ray_get_and_free() to optimize memory usage (#4586)

This commit is contained in:
Eric Liang
2019-04-17 20:30:03 -04:00
committed by GitHub
parent 20c4c16891
commit 6848dfd179
19 changed files with 82 additions and 21 deletions
@@ -17,6 +17,7 @@ from ray.rllib.utils.annotations import override
from ray.rllib.utils.compression import pack_if_needed
from ray.rllib.utils.timer import TimerStat
from ray.rllib.utils.schedules import LinearSchedule
from ray.rllib.utils.memory import ray_get_and_free
logger = logging.getLogger(__name__)
@@ -89,7 +90,7 @@ class SyncReplayOptimizer(PolicyOptimizer):
with self.sample_timer:
if self.remote_evaluators:
batch = SampleBatch.concat_samples(
ray.get(
ray_get_and_free(
[e.sample.remote() for e in self.remote_evaluators]))
else:
batch = self.local_evaluator.sample()