Skip to content

Add a warning when returning an object w/ num_returns=0 #51827

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

justinrmiller
Copy link
Contributor

Why are these changes needed?

If you set num_returns=0, it is likely a mistake if you return a non-None object. We should print a warning message in this case to avoid confusion.

This code prints a warning message if num_returns equals zero and the returned object is non-None.

Related issue number

Closes #51789

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

@jcotant1 jcotant1 added the core Issues that should be addressed in Ray Core label Mar 31, 2025
@shubhamdagar9854 shubhamdagar9854 mentioned this pull request Apr 1, 2025
8 tasks
@hainesmichaelc hainesmichaelc added the community-contribution Contributed by the community label Apr 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community-contribution Contributed by the community core Issues that should be addressed in Ray Core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[core] Add a warning when returning an object w/ num_returns=0
4 participants