Implement select to enable waiting for a specific number of remote objects to be ready. (#369)

This commit is contained in:
Wapaul1
2016-08-15 16:51:59 -07:00
committed by Philipp Moritz
parent b29fc0c481
commit 7246013008
11 changed files with 119 additions and 2 deletions
+4 -1
View File
@@ -55,7 +55,10 @@ if __name__ == "__main__":
# Fetch the results of the tasks and print the results.
for i in range(trials):
params, result_id = results[i]
# Get the index of the first task that completes.
index = ray.select([result_id for _, result_id in results], num_objects=1)[0]
# Process the output of this task and remove it from the list.
params, result_id = results.pop(index)
accuracy = ray.get(result_id)
print """We achieve accuracy {:.3}% with
learning_rate: {:.2}