[xray] Implement fetch (#2195)

This commit is contained in:
Philipp Moritz
2018-06-09 23:36:27 -07:00
committed by Robert Nishihara
parent 125fe1c09c
commit 4ec5bea03b
11 changed files with 120 additions and 79 deletions
+11 -3
View File
@@ -449,7 +449,9 @@ class Worker(object):
self.plasma_client.fetch(plain_object_ids[i:(
i + ray._config.worker_fetch_request_size())])
else:
print("plasma_client.fetch has not been implemented yet")
self.local_scheduler_client.reconstruct_objects(
object_ids[i:(
i + ray._config.worker_fetch_request_size())], True)
# Get the objects. We initially try to get the objects immediately.
final_results = self.retrieve_and_deserialize(plain_object_ids, 0)
@@ -466,20 +468,26 @@ class Worker(object):
# repeat.
while len(unready_ids) > 0:
for unready_id in unready_ids:
self.local_scheduler_client.reconstruct_object(unready_id)
self.local_scheduler_client.reconstruct_objects(
[ray.ObjectID(unready_id)], False)
# Do another fetch for objects that aren't available locally yet,
# in case they were evicted since the last fetch. We divide the
# fetch into smaller fetches so as to not block the manager for a
# prolonged period of time in a single call.
object_ids_to_fetch = list(
map(plasma.ObjectID, unready_ids.keys()))
ray_object_ids_to_fetch = list(
map(ray.ObjectID, unready_ids.keys()))
for i in range(0, len(object_ids_to_fetch),
ray._config.worker_fetch_request_size()):
if not self.use_raylet:
self.plasma_client.fetch(object_ids_to_fetch[i:(
i + ray._config.worker_fetch_request_size())])
else:
print("plasma_client.fetch has not been implemented yet")
self.local_scheduler_client.reconstruct_objects(
ray_object_ids_to_fetch[i:(
i + ray._config.worker_fetch_request_size())],
True)
results = self.retrieve_and_deserialize(
object_ids_to_fetch,
max([