Skip to content

[core] Speed up test_actor_advanced.py#53738

Merged
edoakes merged 11 commits intoray-project:masterfrom
edoakes:eoakes/speedup-test-actor-advanced
Jun 12, 2025
Merged

[core] Speed up test_actor_advanced.py#53738
edoakes merged 11 commits intoray-project:masterfrom
edoakes:eoakes/speedup-test-actor-advanced

Conversation

@edoakes
Copy link
Copy Markdown
Collaborator

@edoakes edoakes commented Jun 11, 2025

test_create_actor_race_condition previously took ~55s locally, now down to ~5s.

  • Removed outer loop running the test 50 times (excessive).
  • Added assertion that only one actor is actually created. Previously there could still be a race to create the actor.
  • Converted to use concurrent futures thread pool.

test_get_actor_race_condition previously took ~10s locally, now down to ~4s.

  • Removed outer loop running the test 50 times (excessive).
  • Added assertion that only one actor is actually created. Previously there could still be a race to create the actor.

Reduced the number of actors on a few other tests and deleted two skipped/useless ones.

Test passed in 237s on this premerge.
Test passed in 350s on latest postmerge.

edoakes added 2 commits June 11, 2025 12:01
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
@edoakes edoakes requested review from a team and ruisearch42 June 11, 2025 17:02
@edoakes edoakes added the go add ONLY when ready to merge, run all tests label Jun 11, 2025
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
@edoakes edoakes changed the title [core] Speed up test_create_actor_race_condition [core] Speed up test_actor_advanced.py Jun 11, 2025
edoakes added 3 commits June 11, 2025 12:18
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
@edoakes edoakes force-pushed the eoakes/speedup-test-actor-advanced branch from c77c8b9 to b0def65 Compare June 11, 2025 17:27
edoakes added 2 commits June 11, 2025 12:28
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>


def test_remote_functions_not_scheduled_on_actors(ray_start_regular):
# Make sure that regular remote functions are not scheduled on actors.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the paranoid survive.

def __init__(self):
pass
worker_node_ids = set()
for i in range(2):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we test with an odd number of nodes and an odd number of actors too?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see a strong reason for it

Comment on lines -406 to -421
@pytest.mark.skip("Garbage collection for distributed actor handles not implemented.")
def test_garbage_collection(setup_queue_actor):
queue = setup_queue_actor

@ray.remote
def fork(queue):
for i in range(10):
x = queue.enqueue.remote(0, i)
time.sleep(0.1)
return ray.get(x)

x = fork.remote(queue)
ray.get(queue.read.remote())
del queue

print(ray.get(x))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💪

Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
@israbbani israbbani self-assigned this Jun 11, 2025
edoakes added 2 commits June 11, 2025 17:07
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Copy link
Copy Markdown
Contributor

@israbbani israbbani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

@edoakes edoakes merged commit 0cb6687 into ray-project:master Jun 12, 2025
5 checks passed
elliot-barn pushed a commit that referenced this pull request Jun 18, 2025
`test_create_actor_race_condition` previously took ~55s locally, now
down to ~5s.

- Removed outer loop running the test 50 times (excessive).
- Added assertion that only one actor is actually created. Previously
there could still be a race to create the actor.
- Converted to use concurrent futures thread pool.

`test_get_actor_race_condition` previously took ~10s locally, now down
to ~4s.

- Removed outer loop running the test 50 times (excessive).
- Added assertion that only one actor is actually created. Previously
there could still be a race to create the actor.

Reduced the number of actors on a few other tests and deleted two
skipped/useless ones.

Test passed in 237s on this
[premerge](https://buildkite.com/ray-project/premerge/builds/41870#0197600a-f4bf-414c-838d-eb5cb05c821d/185-1140).
Test passed in 350s on latest
[postmerge](https://buildkite.com/ray-project/postmerge/builds/10777#01975fbd-c04e-4cf5-8efe-2aa2d7c5c3b3/177-1163).

---------

Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
elliot-barn pushed a commit that referenced this pull request Jul 2, 2025
`test_create_actor_race_condition` previously took ~55s locally, now
down to ~5s.

- Removed outer loop running the test 50 times (excessive).
- Added assertion that only one actor is actually created. Previously
there could still be a race to create the actor.
- Converted to use concurrent futures thread pool.

`test_get_actor_race_condition` previously took ~10s locally, now down
to ~4s.

- Removed outer loop running the test 50 times (excessive).
- Added assertion that only one actor is actually created. Previously
there could still be a race to create the actor.

Reduced the number of actors on a few other tests and deleted two
skipped/useless ones.

Test passed in 237s on this
[premerge](https://buildkite.com/ray-project/premerge/builds/41870#0197600a-f4bf-414c-838d-eb5cb05c821d/185-1140).
Test passed in 350s on latest
[postmerge](https://buildkite.com/ray-project/postmerge/builds/10777#01975fbd-c04e-4cf5-8efe-2aa2d7c5c3b3/177-1163).

---------

Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants