not share registered objects between _Regitry objects (#1508)

This commit is contained in:
the-sea 2018-02-04 07:03:52 +08:00 committed by Eric Liang
parent 0a79442954
commit d0dd33e13c
2 changed files with 4 additions and 4 deletions

View file

@ -8,7 +8,7 @@ import os
import pickle
import tensorflow as tf
from ray.tune.registry import ENV_CREATOR, get_registry
from ray.tune.registry import ENV_CREATOR
from ray.tune.result import TrainingResult
from ray.tune.trainable import Trainable
@ -63,7 +63,7 @@ class Agent(Trainable):
_allow_unknown_subkeys = []
def __init__(
self, config=None, env=None, registry=get_registry(),
self, config=None, env=None, registry=None,
logger_creator=None):
"""Initialize an RLLib agent.

View file

@ -77,8 +77,8 @@ def _from_pinnable(obj):
class _Registry(object):
def __init__(self, objs={}):
self._all_objects = objs
def __init__(self, objs=None):
self._all_objects = {} if objs is None else objs.copy()
self._refs = [] # hard refs that prevent eviction of objects
def register(self, category, key, value):