1
0
mirror of https://github.com/gryf/coach.git synced 2025-12-17 19:20:19 +01:00
Files
coach/rl_coach/memories/backend/memory_impl.py
Ajay Deshpande 6b2de6ba6d Adding initial interface for backend and redis pubsub (#19)
* Adding initial interface for backend and redis pubsub

* Addressing comments, adding super in all memories

* Removing distributed experience replay
2018-10-23 16:51:48 -04:00

22 lines
673 B
Python

from rl_coach.memories.backend.memory import MemoryBackendParameters
from rl_coach.memories.backend.redis import RedisPubSubBackend, RedisPubSubMemoryBackendParameters
def get_memory_backend(params: MemoryBackendParameters):
backend = None
if type(params) == RedisPubSubMemoryBackendParameters:
backend = RedisPubSubBackend(params)
return backend
def construct_memory_params(json: dict):
if json['store_type'] == 'redispubsub':
memory_params = RedisPubSubMemoryBackendParameters(
json['redis_address'], json['redis_port'], channel=json.get('channel', ''), run_type=json['run_type']
)
return memory_params