这是indexloc提供的服务,不要输入任何密码
Skip to content

Tests are failing for RayEnvWorker #747

@Markus28

Description

@Markus28
  • I have marked all applicable categories:
    • exception-raising bug
    • RL algorithm bug
    • documentation request (i.e. "X is missing from the documentation.")
    • new feature request
  • I have visited the source website
  • I have searched through the issue tracker for duplicates
  • I have mentioned version numbers, operating system and environment, where applicable:

Running the unit tests on

Python 3.10.6 (main, Aug 2 2022, 00:00:00) [GCC 11.3.1 20220421 (Red Hat 11.3.1-2)] on linux

with ray 2.0.0, we get the following exception:

______________________________________________________________________________________________________________ test_async_env _______________________________________________________________________________________________________________

size = 10000, num = 8, sleep = 0.1

    def test_async_env(size=10000, num=8, sleep=0.1):
        # simplify the test case, just keep stepping
        env_fns = [
            lambda i=i: MyTestEnv(size=i, sleep=sleep, random_sleep=True)
            for i in range(size, size + num)
        ]
        test_cls = [SubprocVectorEnv, ShmemVectorEnv]
        if has_ray():
            test_cls += [RayVectorEnv]
        for cls in test_cls:
            v = cls(env_fns, wait_num=num // 2, timeout=1e-3)
>           v.seed(None)

test/base/test_env.py:66: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tianshou/env/venvs.py:329: in seed
    return [w.seed(s) for w, s in zip(self.workers, seed_list)]
tianshou/env/venvs.py:329: in <listcomp>
    return [w.seed(s) for w, s in zip(self.workers, seed_list)]
tianshou/env/worker/ray.py:66: in seed
    return ray.get(self.env.seed.remote(seed))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Actor(_SetAttrWrapper, 6127ea1483717728cd9940b301000000), item = 'seed'

    def __getattr__(self, item):
        if not self._ray_is_cross_language:
>           raise AttributeError(
                f"'{type(self).__name__}' object has " f"no attribute '{item}'"
            )
E           AttributeError: 'ActorHandle' object has no attribute 'seed'

/home/markus/OpenSourceDev/venvs/tianshou_env/lib64/python3.10/site-packages/ray/actor.py:1184: AttributeError

The same issue persists with ray==1.13.0.

I haven't investigated this further, but could it be that

except NotImplementedError:
should handle an AttributeError instead?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions