anyscale / academy

Ray tutorials from Anyscale
https://anyscale.com
Apache License 2.0
580 stars 195 forks source link

ray-crash-course/06-Exploring-Ray-API-Calls.ipynb there is an incorrect API parameter #47

Open japsonzbz opened 3 years ago

japsonzbz commented 3 years ago

In part @ray.remote(),the argument named num_return_vals is different from that in the Ray Docs.

When I execute the sample code given in notebook:

@ray.remote(num_return_vals=3)
def tuple3(one, two, three):
    return (one, two, three)
...

The following error will appear:

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-9-05124ba20d56> in <module>
----> 1 @ray.remote(num_return_vals=3)
      2 def tuple3(one, two, three):
      3     return (one, two, three)
      4 
      5 x_ref, y_ref, z_ref = tuple3.remote("a", 1, 2.2)

~/opt/anaconda3/envs/anyscale-academy/lib/python3.7/site-packages/ray/worker.py in remote(*args, **kwargs)
   1926             "max_task_retries",
   1927             "max_retries",
-> 1928         ], error_string
   1929 
   1930     num_cpus = kwargs["num_cpus"] if "num_cpus" in kwargs else None

AssertionError: The @ray.remote decorator must be applied either with no arguments and no parentheses, for example '@ray.remote', or it must be applied using some of the arguments 'num_returns', 'num_cpus', 'num_gpus', 'memory', 'object_store_memory', 'resources', 'max_calls', or 'max_restarts', like '@ray.remote(num_returns=2, resources={"CustomResource": 1})'.

I checked the documentation Ray v2.0.0.dev0 and the correct parameters should be as follows:

@ray.remote(num_returns=3)
...