mirror of
https://github.com/wassname/ray.git
synced 2026-07-11 17:59:28 +08:00
Allow users to serialize custom classes. (#393)
* Allow serialization of custom classes. * Add documentation and test cases, also fix pickle case. * Don't allow old-style classes.
This commit is contained in:
committed by
Philipp Moritz
parent
d5cb3ac090
commit
11a8914684
@@ -16,14 +16,6 @@ class DistArray(object):
|
||||
if self.num_blocks != list(self.objectids.shape):
|
||||
raise Exception("The fields `num_blocks` and `objectids` are inconsistent, `num_blocks` is {} and `objectids` has shape {}".format(self.num_blocks, list(self.objectids.shape)))
|
||||
|
||||
@staticmethod
|
||||
def deserialize(primitives):
|
||||
(shape, objectids) = primitives
|
||||
return DistArray(shape, objectids)
|
||||
|
||||
def serialize(self):
|
||||
return (self.shape, self.objectids)
|
||||
|
||||
@staticmethod
|
||||
def compute_block_lower(index, shape):
|
||||
if len(index) != len(shape):
|
||||
|
||||
Reference in New Issue
Block a user