[Core] put small objects in memory store (#8972)

* remove the put in memory store

* put small objects directly in memory store

* cast data type

* fix another place that uses Put to spill to plasma store

* fix multiple tests related to memory limits

* partially fix test_metrics

* remove not functioning codes

* fix core_worker_test

* refactor put to plasma codes

* add a flag for the new feature

* add flag to more places

* do a warmup round for the plasma store

* lint

* lint again

* fix warmup store

* Update _raylet.pyx

Co-authored-by: Eric Liang <ekhliang@gmail.com>
This commit is contained in:
Zhuohan Li
2020-07-09 15:39:40 -07:00
committed by GitHub
parent 34b85659d4
commit 8a76f4cbb5
18 changed files with 132 additions and 51 deletions
+6 -5
View File
@@ -484,15 +484,16 @@ def test_shutdown_disconnect_global_state():
@pytest.mark.parametrize(
"ray_start_object_store_memory", [150 * 1024 * 1024], indirect=True)
def test_put_pins_object(ray_start_object_store_memory):
x_id = ray.put("HI")
obj = np.ones(200 * 1024, dtype=np.uint8)
x_id = ray.put(obj)
x_binary = x_id.binary()
assert ray.get(ray.ObjectID(x_binary)) == "HI"
assert (ray.get(ray.ObjectID(x_binary)) == obj).all()
# x cannot be evicted since x_id pins it
for _ in range(10):
ray.put(np.zeros(10 * 1024 * 1024))
assert ray.get(x_id) == "HI"
assert ray.get(ray.ObjectID(x_binary)) == "HI"
assert (ray.get(x_id) == obj).all()
assert (ray.get(ray.ObjectID(x_binary)) == obj).all()
# now it can be evicted since x_id pins it but x_binary does not
del x_id
@@ -502,7 +503,7 @@ def test_put_pins_object(ray_start_object_store_memory):
ray.ObjectID(x_binary))
# weakref put
y_id = ray.put("HI", weakref=True)
y_id = ray.put(obj, weakref=True)
for _ in range(10):
ray.put(np.zeros(10 * 1024 * 1024))
with pytest.raises(ray.exceptions.UnreconstructableError):