get rid of numbuf sudo command

This commit is contained in:
Philipp Moritz
2016-06-25 13:28:33 -07:00
parent abaa4211d4
commit dc70c90c2e
3 changed files with 4 additions and 7 deletions
+3
View File
@@ -47,6 +47,9 @@ def from_primitive(primitive_obj):
obj.deserialize(primitive_obj[1])
return obj
def is_arrow_serializable(value):
return type(value) == np.ndarray and value.dtype.name in ["int8", "int16", "int32", "int64", "uint8", "uint16", "uint32", "uint64", "float32", "float64"]
def serialize(worker_capsule, obj):
primitive_obj = to_primitive(obj)
obj_capsule, contained_objrefs = ray.lib.serialize_object(worker_capsule, primitive_obj) # contained_objrefs is a list of the objrefs contained in obj
+1 -2
View File
@@ -6,7 +6,6 @@ from types import ModuleType
import typing
import funcsigs
import numpy as np
import pynumbuf
import colorama
import ray
@@ -35,7 +34,7 @@ class Worker(object):
def put_object(self, objref, value):
"""Put `value` in the local object store with objref `objref`. This assumes that the value for `objref` has not yet been placed in the local object store."""
if pynumbuf.serializable(value):
if serialization.is_arrow_serializable(value):
ray.lib.put_arrow(self.handle, objref, value)
else:
object_capsule, contained_objrefs = serialization.serialize(self.handle, value) # contained_objrefs is a list of the objrefs contained in object_capsule