Allow remote decorator to be used with no parentheses.

This commit is contained in:
Robert Nishihara
2016-08-30 16:38:26 -07:00
parent ce4e5ec544
commit fb7ccef493
22 changed files with 193 additions and 175 deletions
+6 -6
View File
@@ -107,7 +107,7 @@ def add(a, b):
```
A remote function in Ray looks like this.
```python
@ray.remote()
@ray.remote
def add(a, b):
return a + b
```
@@ -194,7 +194,7 @@ around `time.sleep`.
```python
import time
@ray.remote()
@ray.remote
def sleep(n):
time.sleep(n)
return 0
@@ -245,11 +245,11 @@ Computation graphs encode dependencies. For example, suppose we define
```python
import numpy as np
@ray.remote()
@ray.remote
def zeros(shape):
return np.zeros(shape)
@ray.remote()
@ray.remote
def dot(a, b):
return np.dot(a, b)
```
@@ -282,12 +282,12 @@ processes can also call remote functions. To illustrate this, consider the
following example.
```python
@ray.remote()
@ray.remote
def sub_experiment(i, j):
# Run the jth sub-experiment for the ith experiment.
return i + j
@ray.remote()
@ray.remote
def run_experiment(i):
sub_results = []
# Launch tasks to perform 10 sub-experiments in parallel.