mirror of
https://github.com/wassname/ray.git
synced 2026-06-29 14:06:42 +08:00
Plasma C extensions (#34)
* switch plasma from ctypes to python C API * clang-format * various fixes
This commit is contained in:
committed by
Robert Nishihara
parent
ad6a401740
commit
986ed5c9e8
@@ -29,11 +29,11 @@ WORKER_MODE = 1
|
||||
PYTHON_MODE = 2
|
||||
SILENT_MODE = 3
|
||||
|
||||
def random_object_id():
|
||||
return photon.ObjectID("".join([chr(random.randint(0, 255)) for _ in range(20)]))
|
||||
|
||||
def random_string():
|
||||
return "".join([chr(random.randint(0, 255)) for _ in range(20)])
|
||||
return np.random.bytes(20)
|
||||
|
||||
def random_object_id():
|
||||
return photon.ObjectID(random_string())
|
||||
|
||||
class FunctionID(object):
|
||||
def __init__(self, function_id):
|
||||
@@ -418,7 +418,7 @@ class Worker(object):
|
||||
# Serialize and put the object in the object store.
|
||||
schema, size, serialized = numbuf_serialize(value)
|
||||
size = size + 4096 * 4 + 8 # The last 8 bytes are for the metadata offset. This is temporary.
|
||||
buff = self.plasma_client.create(objectid.id(), size, buffer(schema))
|
||||
buff = self.plasma_client.create(objectid.id(), size, bytearray(schema))
|
||||
data = np.frombuffer(buff.buffer, dtype="byte")[8:]
|
||||
metadata_offset = numbuf.write_to_buffer(serialized, memoryview(data))
|
||||
np.frombuffer(buff.buffer, dtype="int64", count=1)[0] = metadata_offset
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ setup(name="ray",
|
||||
package_data={"common": ["thirdparty/redis-3.2.3/src/redis-server"],
|
||||
"plasma": ["build/plasma_store",
|
||||
"build/plasma_manager",
|
||||
"build/plasma_client.so"],
|
||||
"lib/python/libplasma.so"],
|
||||
"photon": ["build/photon_scheduler",
|
||||
"libphoton.so"]},
|
||||
cmdclass={"install": install},
|
||||
|
||||
Reference in New Issue
Block a user