Skip to content

add api to get application url#53796

Merged
zcin merged 4 commits intomasterfrom
SERVE-849-abrar-url
Jun 16, 2025
Merged

add api to get application url#53796
zcin merged 4 commits intomasterfrom
SERVE-849-abrar-url

Conversation

@abrarsheikh
Copy link
Copy Markdown
Contributor

No description provided.

Signed-off-by: abrar <abrar@anyscale.com>
@abrarsheikh abrarsheikh added the go add ONLY when ready to merge, run all tests label Jun 13, 2025
@abrarsheikh abrarsheikh marked this pull request as ready for review June 13, 2025 17:30
Copilot AI review requested due to automatic review settings June 13, 2025 17:30
@abrarsheikh abrarsheikh requested a review from a team as a code owner June 13, 2025 17:30
@abrarsheikh abrarsheikh requested review from edoakes and zcin June 13, 2025 17:30
Copy link
Copy Markdown
Contributor

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 introduces a new developer API to retrieve application URLs dynamically rather than hardcoding them. The key changes include:

  • Replacing literal URLs in tests with dynamic calls to get_application_url(s).
  • Adding get_application_urls and get_application_url API methods in python/ray/serve/api.py.
  • Updating controller and constant definitions to support proxy URL selection and maintain consistency.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
python/ray/serve/tests/test_api.py Updated test cases to use dynamic API calls for application URLs
python/ray/serve/api.py Added new API methods to get application URLs with proper protocol support
python/ray/serve/_private/controller.py Modified target group retrieval to support proxy and gRPC URL formation
python/ray/serve/_private/constants.py Introduced a constant to control URL selection behavior
python/ray/serve/init.py Updated exported API to include the new URL methods
Comments suppressed due to low confidence (1)

python/ray/serve/api.py:1157

  • Document the non-deterministic behavior of get_application_url when multiple URLs are available to ensure that users understand a random URL is returned, which is important for clarity in multi-target setups.
return random.choice(get_application_urls(protocol, app_name, proxy_ingress))

proxy_ingress: Whether to use the proxy ingress.

Returns:
The URL of the application. If there are multiple URLs, a random one is returned.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why would there ever be multiple?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

when location -> EveryNode, there will be one target per node.

Args:
protocol: The protocol to use for the application.
app_name: The name of the application.
proxy_ingress: Whether to use the proxy ingress.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

"proxy ingress" is a highly confusing term because we call the deployment that handles HTTP the "ingress"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

How about use_proxy_targets? and change the env var to RAY_SERVE_USE_PROXY_TARGETS_TO_GET_APPLICATION_URLS

targets=self.proxy_state_manager.get_targets(RequestProtocol.HTTP),
)
)
if is_grpc_enabled(self.get_grpc_config()):
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@akyang-anyscale this fixes a bug, before we would include the grpc targets even if grpc was not enabled.

@abrarsheikh
Copy link
Copy Markdown
Contributor Author

discussed offline with @edoakes and we decided to move the function to a test_utils until the API stabilizes

Signed-off-by: abrar <abrar@anyscale.com>
Signed-off-by: abrar <abrar@anyscale.com>
@abrarsheikh abrarsheikh changed the title add new developer api to get application url add api to get application url Jun 16, 2025
Signed-off-by: abrar <abrar@anyscale.com>
@zcin zcin merged commit 7e17b33 into master Jun 16, 2025
5 checks passed
@zcin zcin deleted the SERVE-849-abrar-url branch June 16, 2025 20:57
elliot-barn pushed a commit that referenced this pull request Jun 18, 2025
Signed-off-by: abrar <abrar@anyscale.com>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
minerharry pushed a commit to minerharry/ray that referenced this pull request Jun 27, 2025
Signed-off-by: abrar <abrar@anyscale.com>
elliot-barn pushed a commit that referenced this pull request Jul 2, 2025
Signed-off-by: abrar <abrar@anyscale.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.

4 participants