Skip to content

Trouble with recursive remote calls #451

Closed
@akamaus

Description

Hi, the following snippet doesn't work for me. Is recursion supported?

import ray
ray.init(num_workers=10)

@ray.remote
def async_inc(k):
    if k >= 0:
        r=async_inc.remote(k-1)
        return ray.get(r) + 1
    else:
        return 0

print(ray.get(async_inc.remote(5)))
RayGetError: Could not get objectid ObjectID(1a3c2e6450938e5226f120e34f7b0e60c45e8809). It was created by remote function __main__.async_inc which failed with:

Remote function __main__.async_inc failed with:

Traceback (most recent call last):
  File "<ipython-input-1-44885ce2c17a>", line 7, in async_inc
NameError: name 'async_inc' is not defined

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions