* Implement actor field for tasks * Implement actor management in local scheduler. * initial python frontend for actors * import actors on worker * IPython code completion and tests * prepare creating actors through local schedulers * add actor id to PyTask * submit actor calls to local scheduler * starting to integrate * simple fix * Fixes from rebasing. * more work on python actors * Improve local scheduler actor handlers. * Pass actor ID to local scheduler when connecting a client. * first working version of actors * fixing actors * fix creating two copies of the same actor * fix actors * remove sleep * get rid of export synchronization * update * insert actor methods into the queue in the right order * remove print statements * make it compile again after rebase * Minor updates. * fix python actor ids * Pass actor_id to start_worker. * add test * Minor changes. * Update actor tests. * Temporary plan for import counter. * Temporarily fix import counters. * Fix some tests. * Fixes. * Make actor creation non-blocking. * Fix test? * Fix actors on Python 2. * fix rare case. * Fix python 2 test. * More tests. * Small fixes. * Linting. * Revert tensorflow version to 0.12.0 temporarily. * Small fix. * Enhance inheritance test.
Ray
Ray is an experimental distributed execution engine. It is under development and not ready to be used.
The goal of Ray is to make it easy to write machine learning applications that run on a cluster while providing the development and debugging experience of working on a single machine.
Before jumping into the details, here's a simple Python example for doing a Monte Carlo estimation of pi (using multiple cores or potentially multiple machines).
import ray
import numpy as np
# Start Ray with some workers.
ray.init(num_workers=10)
# Define a remote function for estimating pi.
@ray.remote
def estimate_pi(n):
x = np.random.uniform(size=n)
y = np.random.uniform(size=n)
return 4 * np.mean(x ** 2 + y ** 2 < 1)
# Launch 10 tasks, each of which estimates pi.
result_ids = []
for _ in range(10):
result_ids.append(estimate_pi.remote(100))
# Fetch the results of the tasks and print their average.
estimate = np.mean(ray.get(result_ids))
print("Pi is approximately {}.".format(estimate))
Within the for loop, each call to estimate_pi.remote(100) sends a message to
the scheduler asking it to schedule the task of running estimate_pi with the
argument 100. This call returns right away without waiting for the actual
estimation of pi to take place. Instead of returning a float, it returns an
object ID, which represents the eventual output of the computation (this is
a similar to a Future).
The call to ray.get(result_id) takes an object ID and returns the actual
estimate of pi (waiting until the computation has finished if necessary).