mirror of
https://github.com/wassname/ray.git
synced 2026-07-13 11:12:12 +08:00
[GCS] Monitor.py bug fix (#8725)
* comment. * Fix bugs. * Used pubsub message instead. * Added a ray.actors test
This commit is contained in:
@@ -106,6 +106,28 @@ def test_global_state_actor_table(ray_start_regular):
|
||||
assert get_state() == dead_state
|
||||
|
||||
|
||||
def test_global_state_actor_entry(ray_start_regular):
|
||||
@ray.remote
|
||||
class Actor:
|
||||
def ready(self):
|
||||
pass
|
||||
|
||||
# actor table should be empty at first
|
||||
assert len(ray.actors()) == 0
|
||||
|
||||
a = Actor.remote()
|
||||
b = Actor.remote()
|
||||
ray.get(a.ready.remote())
|
||||
ray.get(b.ready.remote())
|
||||
assert len(ray.actors()) == 2
|
||||
a_actor_id = a._actor_id.hex()
|
||||
b_actor_id = b._actor_id.hex()
|
||||
assert ray.actors(actor_id=a_actor_id)["ActorID"] == a_actor_id
|
||||
assert ray.actors(actor_id=a_actor_id)["State"] == 1
|
||||
assert ray.actors(actor_id=b_actor_id)["ActorID"] == b_actor_id
|
||||
assert ray.actors(actor_id=b_actor_id)["State"] == 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import pytest
|
||||
import sys
|
||||
|
||||
Reference in New Issue
Block a user