Ray list placement-groups fails

ray start --head

Usage stats collection is enabled. To disable this, add `--disable-usage-stats` to the command that starts the cluster, or run the following command: `ray disable-usage-stats` before starting the cluster. See https://docs.ray.io/en/master/cluster/usage-stats.html for more details.

Local node IP: 10.140.60.208

--------------------
Ray runtime started.
--------------------

Next steps
  To add another node to this Ray cluster, run
    ray start --address='10.140.60.208:6379'
  
  To connect to this Ray cluster:
    import ray
    ray.init()
  
  To submit a Ray job using the Ray Jobs CLI:
    RAY_ADDRESS='http://127.0.0.1:8265' ray job submit --working-dir . -- python my_script.py
  
  See https://docs.ray.io/en/latest/cluster/running-applications/job-submission/index.html 
  for more information on submitting Ray jobs to the Ray cluster.
  
  To terminate the Ray runtime, run
    ray stop
  
  To view the status of the cluster, use
    ray status
  
  To monitor and debug Ray, view the dashboard at 
    127.0.0.1:8265
  
  If connection to the dashboard fails, check your firewall settings and network configuration.

run my code as follows

# ray start --head 
import ray

ray.init(address="auto")  

# 创建一个简单的 Placement Group
from ray.util.placement_group import placement_group
pg = placement_group([{"CPU": 1}], strategy="STRICT_PACK")
ray.get(pg.ready())  # 等待 Placement Group 准备就绪

print("Placement Group created successfully:", pg)

import time 
time.sleep(10)

from ray.util.state import list_placement_groups, list_actors
# 列出所有 Placement Groups
placement_groups = list_placement_groups()
for pg in placement_groups:
    print(pg)

It reports

(layer) (base) [gaowei@HOST-10-140-60-208 llumnix]$ python demo.py 
2025-03-17 20:35:01,283 INFO worker.py:1540 -- Connecting to existing Ray cluster at address: 10.140.60.208:6379...
2025-03-17 20:35:01,291 INFO worker.py:1715 -- Connected to Ray cluster. View the dashboard at 127.0.0.1:8265 
Placement Group created successfully: <ray.util.placement_group.PlacementGroup object at 0x7f3217eaffd0>
Traceback (most recent call last):
  File "/mnt/petrelfs/gaowei/anaconda3/envs/layer/lib/python3.10/site-packages/requests/models.py", line 974, in json
    return complexjson.loads(self.text, **kwargs)
  File "/mnt/petrelfs/gaowei/anaconda3/envs/layer/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/mnt/petrelfs/gaowei/anaconda3/envs/layer/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/mnt/petrelfs/gaowei/anaconda3/envs/layer/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/mnt/hwfile/gaowei/PAPER/Length/research/llumnix/demo.py", line 18, in <module>
    placement_groups = list_placement_groups()
  File "/mnt/petrelfs/gaowei/anaconda3/envs/layer/lib/python3.10/site-packages/ray/util/state/api.py", line 865, in list_placement_groups
    return StateApiClient(address=address).list(
  File "/mnt/petrelfs/gaowei/anaconda3/envs/layer/lib/python3.10/site-packages/ray/util/state/api.py", line 492, in list
    list_api_response = self._make_http_get_request(
  File "/mnt/petrelfs/gaowei/anaconda3/envs/layer/lib/python3.10/site-packages/ray/util/state/api.py", line 225, in _make_http_get_request
    response = response.json()
  File "/mnt/petrelfs/gaowei/anaconda3/envs/layer/lib/python3.10/site-packages/requests/models.py", line 978, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

How can I figure out what leads to the failure of list_placement_groups()

Hi @gaow0007 , thanks for report. I’ve moved your question into the Ray Core category so that the right team sees it.

@gaow0007 Which version of ray were you using?

I was able to get the PGs using ray 2.43.0

2025-03-20 00:58:58,693 INFO worker.py:1654 -- Connecting to existing Ray cluster at address: 172.31.15.128:6379...
2025-03-20 00:58:58,705 INFO worker.py:1832 -- Connected to Ray cluster. View the dashboard at 127.0.0.1:8265 
Placement Group created successfully: <ray.util.placement_group.PlacementGroup object at 0x7f65e129feb0>
PlacementGroupState(placement_group_id='0c7168b2516b172407c42dbda97001000000', name='', creator_job_id='01000000', state='CREATED', bundles=None, is_detached=None, stats=None)