Skip to content

finishing commit for issue #52113 #53964

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 1 commit into
base: master
Choose a base branch
from

Conversation

arvchahal
Copy link

@arvchahal arvchahal commented Jun 19, 2025

Why are these changes needed?

Related issue number

Closes #52113

Checks

  • [x ] I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • [ x] I've run scripts/format.sh to lint the changes in this PR.
  • [x ] I've included any doc changes needed for https://docs.ray.io/en/master/.
    • [x ] 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
    • [ x] Unit tests
    • Release tests
    • This PR is not tested :(

@Copilot Copilot AI review requested due to automatic review settings June 19, 2025 23:16
@arvchahal arvchahal requested a review from a team as a code owner June 19, 2025 23:16
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the serve config CLI command to handle cases where no configuration has been deployed and adds a corresponding unit test.

  • Prints a warning message when no configs are available for all apps or a specific app.
  • Refactors config() in scripts.py to first collect configs into a list and branch on its emptiness.
  • Introduces test_serve_config_no_config_prints_warning in test_cli.py to verify the new warning.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
python/ray/serve/scripts.py Refactored config() to print a warning if no configs
python/ray/serve/tests/test_cli.py Added test verifying warning when no serve config exists
Comments suppressed due to low confidence (1)

# Fetch a specific app config by name.
else:
app = serve_details.applications.get(name)
if app is None or app.deployed_app_config is None:
print(f'No config has been deployed for application "{name}".')
else:
config = app.deployed_app_config.dict(exclude_unset=True)
print(yaml.safe_dump(config, sort_keys=False), end="")

print(yaml.safe_dump(config, sort_keys=False), end="" if config else "No config was provided during `serve run`. Nothing to display.")
Copy link
Preview

Copilot AI Jun 19, 2025

Choose a reason for hiding this comment

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

Combining the YAML dump and warning via the end parameter can mix the two outputs. It’s clearer to branch: if config is nonempty, print the dump; otherwise, print only the warning.

Suggested change
print(yaml.safe_dump(config, sort_keys=False), end="" if config else "No config was provided during `serve run`. Nothing to display.")
if config:
print(yaml.safe_dump(config, sort_keys=False))
else:
print("No config was provided during `serve run`. Nothing to display.")

Copilot uses AI. Check for mistakes.

Comment on lines +794 to +796
with pytest.raises(subprocess.CalledProcessError) as e:
subprocess.check_output(["serve", "config"], stderr=subprocess.STDOUT)
output = e.value.output.decode("utf-8")
Copy link
Preview

Copilot AI Jun 19, 2025

Choose a reason for hiding this comment

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

The test expects a non-zero exit (exception) but the CLI now prints a warning and exits 0. Either change the CLI to exit with an error code or update the test to capture and assert on stdout instead of an exception.

Suggested change
with pytest.raises(subprocess.CalledProcessError) as e:
subprocess.check_output(["serve", "config"], stderr=subprocess.STDOUT)
output = e.value.output.decode("utf-8")
output = subprocess.check_output(["serve", "config"], stderr=subprocess.STDOUT).decode("utf-8")

Copilot uses AI. Check for mistakes.

subprocess.check_output(["serve", "config"], stderr=subprocess.STDOUT)
output = e.value.output.decode("utf-8")
assert "No config was provided during `serve run`. Nothing to display." in output
return True
Copy link
Preview

Copilot AI Jun 19, 2025

Choose a reason for hiding this comment

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

[nitpick] A return value in a pytest test function is unnecessary. You can remove return True to keep the test concise.

Suggested change
return True

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Serve] serve config does not return anything
1 participant