Skip to content

[local mode] ray.global_state.cluster_resources() fails #4147

@richardliaw

Description

@richardliaw
In [3]: ray.init(local_mode=True)
Out[3]: {'node_ip_address': None, 'redis_address': None}

In [4]: ray.global_state
Out[4]: <ray.experimental.state.GlobalState at 0x11af9eb70>

In [5]: ray.global_state.cluster_resources()
---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
<ipython-input-5-2a1a6ccf3180> in <module>()
----> 1 ray.global_state.cluster_resources()

~/miniconda3/envs/ray/lib/python3.6/site-packages/ray/experimental/state.py in cluster_resources(self)
    765         """
    766         resources = defaultdict(int)
--> 767         clients = self.client_table()
    768         for client in clients:
    769             # Only count resources from live clients.

~/miniconda3/envs/ray/lib/python3.6/site-packages/ray/experimental/state.py in client_table(self)
    400             Information about the Ray clients in the cluster.
    401         """
--> 402         self._check_connected()
    403
    404         return parse_client_table(self.redis_client)

~/miniconda3/envs/ray/lib/python3.6/site-packages/ray/experimental/state.py in _check_connected(self)
    114         """
    115         if self.redis_client is None:
--> 116             raise Exception("The ray.global_state API cannot be used before "
    117                             "ray.init has been called.")
    118

Exception: The ray.global_state API cannot be used before ray.init has been called.

Metadata

Metadata

Assignees

Labels

P3Issue moderate in impact or severity

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions