Misc direct call fixes from unit tests (#6394)

This commit is contained in:
Eric Liang
2019-12-08 19:34:02 -08:00
committed by GitHub
parent 1a9948eef9
commit a6bc2b1842
13 changed files with 99 additions and 70 deletions
+12 -10
View File
@@ -177,9 +177,11 @@ class SerializationContext(object):
def object_id_deserializer(serialized_obj):
obj_id, owner_id, owner_address = pickle.loads(serialized_obj)
# Must deserialize the object in the core worker before we
# create the ObjectID to ensure that the reference is added
# before we increment its count to 1.
# NOTE(swang): Must deserialize the object first before asking
# the core worker to resolve the value. This is to make sure
# that the ref count for the ObjectID is greater than 0 by the
# time the core worker resolves the value of the object.
deserialized_object_id = obj_id[0](obj_id[1][0])
if owner_id:
worker = ray.worker.get_global_worker()
worker.check_connected()
@@ -187,8 +189,7 @@ class SerializationContext(object):
# (class name, (unique bytes,)).
worker.core_worker.deserialize_and_register_object_id(
obj_id[1][0], owner_id[1][0], owner_address)
obj_id = obj_id[0](obj_id[1][0])
return obj_id
return deserialized_object_id
for id_type in ray._raylet._ID_TYPES:
if id_type == ray._raylet.ObjectID:
@@ -241,9 +242,11 @@ class SerializationContext(object):
def object_id_deserializer(serialized_obj):
obj_id, owner_id, owner_address = serialized_obj
# Must deserialize the object in the core worker before we
# create the ObjectID to ensure that the reference is added
# before we increment its count to 1.
# NOTE(swang): Must deserialize the object first before asking
# the core worker to resolve the value. This is to make sure
# that the ref count for the ObjectID is greater than 0 by the
# time the core worker resolves the value of the object.
deserialized_object_id = id_deserializer(obj_id)
if owner_id:
worker = ray.worker.get_global_worker()
worker.check_connected()
@@ -251,8 +254,7 @@ class SerializationContext(object):
# (class name, (unique bytes,)).
worker.core_worker.deserialize_and_register_object_id(
obj_id[1][0], owner_id[1][0], owner_address)
obj_id = id_deserializer(obj_id)
return obj_id
return deserialized_object_id
for id_type in ray._raylet._ID_TYPES:
if id_type == ray._raylet.ObjectID: