mirror of
https://github.com/wassname/ray.git
synced 2026-07-04 00:33:25 +08:00
Enable memstore by default (#6003)
This commit is contained in:
@@ -657,7 +657,7 @@ cdef class CoreWorker:
|
||||
raylet_socket.encode("ascii"), job_id.native(),
|
||||
gcs_options.native()[0], log_dir.encode("utf-8"),
|
||||
node_ip_address.encode("utf-8"), task_execution_handler,
|
||||
check_signals, False))
|
||||
check_signals))
|
||||
|
||||
def disconnect(self):
|
||||
with nogil:
|
||||
|
||||
@@ -84,8 +84,7 @@ cdef extern from "ray/core_worker/core_worker.h" nogil:
|
||||
const c_vector[CObjectID] &arg_reference_ids,
|
||||
const c_vector[CObjectID] &return_ids,
|
||||
c_vector[shared_ptr[CRayObject]] *returns) nogil,
|
||||
CRayStatus() nogil,
|
||||
c_bool use_memory_store_)
|
||||
CRayStatus() nogil)
|
||||
void Disconnect()
|
||||
CWorkerType &GetWorkerType()
|
||||
CLanguage &GetLanguage()
|
||||
|
||||
@@ -4,9 +4,6 @@ from libc.stdint cimport uint8_t, uint32_t, int64_t
|
||||
|
||||
cdef extern from "ray/common/id.h" namespace "ray" nogil:
|
||||
cdef cppclass CBaseID[T]:
|
||||
@staticmethod
|
||||
T from_random()
|
||||
|
||||
@staticmethod
|
||||
T FromBinary(const c_string &binary)
|
||||
|
||||
@@ -32,7 +29,7 @@ cdef extern from "ray/common/id.h" namespace "ray" nogil:
|
||||
size_t Size()
|
||||
|
||||
@staticmethod
|
||||
CUniqueID from_random()
|
||||
CUniqueID FromRandom()
|
||||
|
||||
@staticmethod
|
||||
CUniqueID FromBinary(const c_string &binary)
|
||||
@@ -133,6 +130,9 @@ cdef extern from "ray/common/id.h" namespace "ray" nogil:
|
||||
@staticmethod
|
||||
CObjectID FromBinary(const c_string &binary)
|
||||
|
||||
@staticmethod
|
||||
CObjectID FromRandom()
|
||||
|
||||
@staticmethod
|
||||
const CObjectID Nil()
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ cdef class UniqueID(BaseID):
|
||||
|
||||
@classmethod
|
||||
def from_random(cls):
|
||||
return cls(os.urandom(CUniqueID.Size()))
|
||||
return cls(CUniqueID.FromRandom().Binary())
|
||||
|
||||
def size(self):
|
||||
return CUniqueID.Size()
|
||||
@@ -197,7 +197,7 @@ cdef class ObjectID(BaseID):
|
||||
|
||||
@classmethod
|
||||
def from_random(cls):
|
||||
return cls(os.urandom(CObjectID.Size()))
|
||||
return cls(CObjectID.FromRandom().Binary())
|
||||
|
||||
|
||||
cdef class TaskID(BaseID):
|
||||
|
||||
@@ -9,7 +9,6 @@ import glob
|
||||
import io
|
||||
import json
|
||||
import logging
|
||||
from multiprocessing import Process
|
||||
import os
|
||||
import random
|
||||
import re
|
||||
@@ -2998,27 +2997,6 @@ def test_object_id_properties():
|
||||
id_dumps = pickle.dumps(object_id)
|
||||
id_from_dumps = pickle.loads(id_dumps)
|
||||
assert id_from_dumps == object_id
|
||||
file_prefix = "test_object_id_properties"
|
||||
|
||||
# Make sure the ids are fork safe.
|
||||
def write(index):
|
||||
str = ray.ObjectID.from_random().hex()
|
||||
with open("{}{}".format(file_prefix, index), "w") as fo:
|
||||
fo.write(str)
|
||||
|
||||
def read(index):
|
||||
with open("{}{}".format(file_prefix, index), "r") as fi:
|
||||
for line in fi:
|
||||
return line
|
||||
|
||||
processes = [Process(target=write, args=(_, )) for _ in range(4)]
|
||||
for process in processes:
|
||||
process.start()
|
||||
for process in processes:
|
||||
process.join()
|
||||
hexes = {read(i) for i in range(4)}
|
||||
[os.remove("{}{}".format(file_prefix, i)) for i in range(4)]
|
||||
assert len(hexes) == 4
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
||||
@@ -11,7 +11,6 @@ import inspect
|
||||
import io
|
||||
import json
|
||||
import logging
|
||||
import numpy as np
|
||||
import os
|
||||
import redis
|
||||
import signal
|
||||
@@ -1491,7 +1490,7 @@ def connect(node,
|
||||
# Put something in the plasma store so that subsequent plasma store
|
||||
# accesses will be faster. Currently the first access is always slow, and
|
||||
# we don't want the user to experience this.
|
||||
temporary_object_id = ray.ObjectID(np.random.bytes(20))
|
||||
temporary_object_id = ray.ObjectID.from_random()
|
||||
worker.put_object(1, object_id=temporary_object_id)
|
||||
ray.internal.free([temporary_object_id])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user