mirror of
https://github.com/wassname/ray.git
synced 2026-06-27 20:22:39 +08:00
This reverts commit a82fa80f7b.
This commit is contained in:
@@ -898,17 +898,16 @@ cdef class CoreWorker:
|
||||
|
||||
return RayObjectsToDataMetadataPairs(results)
|
||||
|
||||
def object_exists(self, ObjectRef object_ref, memory_store_only=False):
|
||||
def object_exists(self, ObjectRef object_ref):
|
||||
cdef:
|
||||
c_bool has_object
|
||||
c_bool is_in_plasma
|
||||
CObjectID c_object_id = object_ref.native()
|
||||
|
||||
with nogil:
|
||||
check_status(CCoreWorkerProcess.GetCoreWorker().Contains(
|
||||
c_object_id, &has_object, &is_in_plasma))
|
||||
c_object_id, &has_object))
|
||||
|
||||
return has_object and (not memory_store_only or not is_in_plasma)
|
||||
return has_object
|
||||
|
||||
cdef _create_put_buffer(self, shared_ptr[CBuffer] &metadata,
|
||||
size_t data_size, ObjectRef object_ref,
|
||||
|
||||
@@ -183,8 +183,7 @@ cdef extern from "ray/core_worker/core_worker.h" nogil:
|
||||
CRayStatus Get(const c_vector[CObjectID] &ids, int64_t timeout_ms,
|
||||
c_vector[shared_ptr[CRayObject]] *results,
|
||||
c_bool plasma_objects_only)
|
||||
CRayStatus Contains(const CObjectID &object_id, c_bool *has_object,
|
||||
c_bool *is_in_plasma)
|
||||
CRayStatus Contains(const CObjectID &object_id, c_bool *has_object)
|
||||
CRayStatus Wait(const c_vector[CObjectID] &object_ids, int num_objects,
|
||||
int64_t timeout_ms, c_vector[c_bool] *results,
|
||||
c_bool fetch_local)
|
||||
|
||||
@@ -521,43 +521,6 @@ def test_wait_makes_object_local(ray_start_cluster):
|
||||
assert ray.worker.global_worker.core_worker.object_exists(x_id)
|
||||
|
||||
|
||||
@pytest.mark.skipif(client_test_enabled(), reason="internal api")
|
||||
def test_future_resolution_skip_plasma(ray_start_cluster):
|
||||
cluster = ray_start_cluster
|
||||
# Disable worker caching so worker leases are not reused; set object
|
||||
# inlining size threshold and enable storing of small objects in in-memory
|
||||
# object store so the borrowed ref is inlined.
|
||||
cluster.add_node(
|
||||
num_cpus=1,
|
||||
resources={"pin_head": 1},
|
||||
_system_config={
|
||||
"worker_lease_timeout_milliseconds": 0,
|
||||
"max_direct_call_object_size": 100 * 1024,
|
||||
"put_small_object_in_memory_store": True,
|
||||
},
|
||||
)
|
||||
cluster.add_node(num_cpus=1, resources={"pin_worker": 1})
|
||||
ray.init(address=cluster.address)
|
||||
|
||||
@ray.remote(resources={"pin_head": 1})
|
||||
def f(x):
|
||||
return x + 1
|
||||
|
||||
@ray.remote(resources={"pin_worker": 1})
|
||||
def g(x):
|
||||
borrowed_ref = x[0]
|
||||
f_ref = f.remote(borrowed_ref)
|
||||
# borrowed_ref should be inlined on future resolution and shouldn't be
|
||||
# in Plasma.
|
||||
assert ray.worker.global_worker.core_worker.object_exists(
|
||||
borrowed_ref, memory_store_only=True)
|
||||
return ray.get(f_ref) * 2
|
||||
|
||||
one = ray.put(1)
|
||||
g_ref = g.remote([one])
|
||||
assert ray.get(g_ref) == 4
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import pytest
|
||||
sys.exit(pytest.main(["-v", __file__]))
|
||||
|
||||
Reference in New Issue
Block a user