[rllib] Remove need to pass around registry (#2250)

* remove registry

* fix

* too many _

* fix

* cloudpickle

* Update registry.py

* yapf

* fix test

* fix kv check
This commit is contained in:
Eric Liang
2018-06-19 22:47:00 -07:00
committed by GitHub
parent 30684446a6
commit 30f7c08ca7
36 changed files with 202 additions and 208 deletions
+18 -2
View File
@@ -2,12 +2,12 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import base64
from six.moves import queue
import base64
import numpy as np
import threading
import ray
from ray.tune.registry import _to_pinnable, _from_pinnable
_pinned_objects = []
_fetch_requests = queue.Queue()
@@ -63,6 +63,22 @@ def _serve_get_pin_requests():
pass
def _to_pinnable(obj):
"""Converts obj to a form that can be pinned in object store memory.
Currently only numpy arrays are pinned in memory, if you have a strong
reference to the array value.
"""
return (obj, np.zeros(1))
def _from_pinnable(obj):
"""Retrieve from _to_pinnable format."""
return obj[0]
if __name__ == '__main__':
ray.init()
X = pin_in_object_store("hello")