Remove ObjectID aliasing from the API. (#406)

* Remove ObjectID aliasing from the API.

* Update documentation to remove aliasing.
This commit is contained in:
Robert Nishihara
2016-09-03 19:34:45 -07:00
committed by Philipp Moritz
parent efb61ca9c7
commit 81f40774a7
7 changed files with 13 additions and 177 deletions
+4 -4
View File
@@ -72,7 +72,7 @@ def tsqr(a):
q_block_current = ra.dot.remote(q_block_current, ra.subarray.remote(q_tree[ith_index, j], lower, upper))
q_result.objectids[i] = q_block_current
r = current_rs[0]
return q_result, r
return q_result, ray.get(r)
# TODO(rkn): This is unoptimized, we really want a block version of this.
@ray.remote(num_return_vals=3)
@@ -103,7 +103,7 @@ def modified_lu(q):
for i in range(b):
L[i, i] = 1
U = np.triu(q_work)[:b, :]
return numpy_to_dist.remote(ray.put(L)), U, S # TODO(rkn): get rid of put
return ray.get(numpy_to_dist.remote(ray.put(L))), U, S # TODO(rkn): get rid of put
@ray.remote(num_return_vals=2)
def tsqr_hr_helper1(u, s, y_top_block, b):
@@ -125,7 +125,7 @@ def tsqr_hr(a):
y_blocked = ray.get(y)
t, y_top = tsqr_hr_helper1.remote(u, s, y_blocked.objectids[0, 0], a.shape[1])
r = tsqr_hr_helper2.remote(s, r_temp)
return y, t, y_top, r
return ray.get(y), ray.get(t), ray.get(y_top), ray.get(r)
@ray.remote
def qr_helper1(a_rc, y_ri, t, W_c):
@@ -183,4 +183,4 @@ def qr(a):
y_col_block = subblocks.remote(y_res, [], [i])
q = subtract.remote(q, dot.remote(y_col_block, dot.remote(Ts[i], dot.remote(transpose.remote(y_col_block), q))))
return q, r_res
return ray.get(q), r_res
+3 -6
View File
@@ -1249,9 +1249,6 @@ def store_outputs_in_objstore(objectids, outputs, worker=global_worker):
"""
for i in range(len(objectids)):
if isinstance(outputs[i], raylib.ObjectID):
# An ObjectID is being returned, so we must alias objectids[i] so that it refers to the same object that outputs[i] refers to
_logger().info("Aliasing objectids {} and {}".format(objectids[i].id, outputs[i].id))
worker.alias_objectids(objectids[i], outputs[i])
pass
else:
worker.put_object(objectids[i], outputs[i])
raise Exception("This remote function returned an ObjectID as its {}th return value. This is not allowed.".format(i))
for i in range(len(objectids)):
worker.put_object(objectids[i], outputs[i])