Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Utils] [CORE-658] ray.util.Queue Empty and Full exceptions extend queue.Empty and Full #50261

Merged
merged 4 commits into from
Feb 6, 2025

Conversation

israbbani
Copy link
Contributor

@israbbani israbbani commented Feb 5, 2025

Simplify ray.util.Queue usage and exception handling by extending queue.Empty and queue.Full.

Closes #50154

israbbani and others added 2 commits February 5, 2025 12:49
to match what multiprocessing.Queue does to simplify
client exception handling

Signed-off-by: Ibrahim Rabbani <[email protected]>
@MengjinYan MengjinYan added the go add ONLY when ready to merge, run all tests label Feb 5, 2025
@israbbani israbbani requested review from jjyao and MengjinYan February 5, 2025 21:03
@israbbani israbbani marked this pull request as ready for review February 5, 2025 21:04
Copy link
Collaborator

@MengjinYan MengjinYan left a comment

Choose a reason for hiding this comment

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

Overall looks good to me! Just a minor process question.


import ray
from ray.util.annotations import PublicAPI


@PublicAPI(stability="beta")
Copy link
Collaborator

Choose a reason for hiding this comment

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

As it is marked as beta, I'm wondering if we should follow the deprecation period mentioned here: https://docs.ray.io/en/latest/ray-contribute/stability.html#beta
cc: @jjyao

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense. I think after Jiajun's comment, I'm going to make the change backwards compatible.


import ray
from ray.util.annotations import PublicAPI


@PublicAPI(stability="beta")
class Empty(Exception):
Copy link
Collaborator

Choose a reason for hiding this comment

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

For backward compatibility, can we make the current Empty and Full the subclass of python Empty and Full?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made the change backwards compatible. Would any of the integration tests have caught this backwards incompatible change?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably we can add a test in python/ray/tests/test_queue.py to validate that the queue will through the expected type of Empty object in the empty scenario.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unless I'm misunderstanding, python/ray/tests/test_queue.py already checks for both Empty and Full exceptions.

I was wondering if there's an API-level spec file or protocol definition that ensures backwards compatibility and disallows incompatible changes.

Copy link
Collaborator

@MengjinYan MengjinYan Feb 6, 2025

Choose a reason for hiding this comment

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

Makes sense for the test part.

For the API spec, I think the annotation is the only thing that we have for now. cc: @jjyao in case you have more context.

Copy link
Collaborator

@MengjinYan MengjinYan left a comment

Choose a reason for hiding this comment

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

Thanks!

@israbbani israbbani changed the title [Utils] ray.util.Queue raises queue.Empty and queue.Full [Utils] ray.util.Queue Empty and Full exceptions extend queue.Empty and Full Feb 6, 2025
@israbbani israbbani changed the title [Utils] ray.util.Queue Empty and Full exceptions extend queue.Empty and Full [Utils] [CORE-658] ray.util.Queue Empty and Full exceptions extend queue.Empty and Full Feb 6, 2025
@jjyao jjyao merged commit d8a4cd7 into ray-project:master Feb 6, 2025
5 checks passed
@rsamf
Copy link

rsamf commented Feb 7, 2025

Thanks for doing this!! 🎉

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.

Can ray.util.queue.Empty extend queue.Empty?
4 participants