Skip to content

[serve] Resolve bundled ray-haproxy binary before RAY_SERVE_HAPROXY_BINARY_PATH#63829

Merged
eicherseiji merged 2 commits into
ray-project:masterfrom
eicherseiji:seiji/haproxy-experimental-flag-forces-bundled
Jun 4, 2026
Merged

[serve] Resolve bundled ray-haproxy binary before RAY_SERVE_HAPROXY_BINARY_PATH#63829
eicherseiji merged 2 commits into
ray-project:masterfrom
eicherseiji:seiji/haproxy-experimental-flag-forces-bundled

Conversation

@eicherseiji
Copy link
Copy Markdown
Contributor

@eicherseiji eicherseiji commented Jun 3, 2026

Why

RAY_SERVE_EXPERIMENTAL_PIP_HAPROXY=1 is supposed to make Ray Serve use the HAProxy binary bundled in the ray-haproxy PyPI package. In practice it was a no-op whenever the runtime image sets RAY_SERVE_HAPROXY_BINARY_PATH — which the Ray images do (docker/base-deps/Dockerfile sets RAY_SERVE_HAPROXY_BINARY_PATH=/usr/local/bin/haproxy).

_resolve_haproxy_binary() honored the explicit-path override before trying the bundled wheel, so with the flag on it returned /usr/local/bin/haproxy and never reached the ray_haproxy package. As a result the *.aws.pip_haproxy nightly release variants (serve_controller_benchmark_haproxy, pytest_serve_autoscaling_load_test) silently benchmarked the image's system build, not the pip binary they were meant to validate.

Confirmed from a pip_haproxy release run's proxy logs: every proxy logged Using HAProxy binary: /usr/local/bin/haproxy; the wheel path never appeared.

What

  • Resolve the bundled ray-haproxy binary first, so the flag takes precedence over an image-baked RAY_SERVE_HAPROXY_BINARY_PATH.
  • The explicit-path override and system-PATH fallback are unchanged, and still apply when the ray-haproxy package is unavailable.
  • Flag-off (default) behavior is unchanged: return RAY_SERVE_HAPROXY_BINARY_PATH verbatim.

No change needed in release_tests.yaml: the existing pip_haproxy variants now actually exercise the pip binary.

Testing

Existing python/ray/serve/tests/unit/test_haproxy_binary.py suite passes against the new ordering (4 tests). Docstring updated to reflect the resolution order.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the HAProxy binary resolution logic in Ray Serve. When the RAY_SERVE_EXPERIMENTAL_PIP_HAPROXY flag is enabled, the system now unconditionally uses the bundled ray-haproxy package binary, ignoring RAY_SERVE_HAPROXY_BINARY_PATH and raising a FileNotFoundError if loading fails, rather than falling back to other binaries. Unit tests have been updated to align with this new behavior. There are no review comments, so I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@eicherseiji eicherseiji force-pushed the seiji/haproxy-experimental-flag-forces-bundled branch from 5958a8c to 7cdc6f7 Compare June 3, 2026 19:45
@eicherseiji eicherseiji changed the title [serve] Make RAY_SERVE_EXPERIMENTAL_PIP_HAPROXY force the bundled binary [serve] Resolve bundled ray-haproxy binary before RAY_SERVE_HAPROXY_BINARY_PATH Jun 3, 2026
…INARY_PATH

RAY_SERVE_EXPERIMENTAL_PIP_HAPROXY was a no-op whenever the runtime image sets
RAY_SERVE_HAPROXY_BINARY_PATH (the Ray images set it to /usr/local/bin/haproxy):
_resolve_haproxy_binary() honored that explicit path before ever trying the
bundled ray-haproxy wheel, so the *.aws.pip_haproxy release variants silently
ran the image's system build instead of the pip binary they meant to test.

Try the bundled ray-haproxy binary first so the flag takes precedence over an
image-baked RAY_SERVE_HAPROXY_BINARY_PATH. The explicit-path and system-PATH
fallbacks are unchanged for when the package is unavailable.

Signed-off-by: Seiji Eicher <seiji@anyscale.com>
@eicherseiji eicherseiji force-pushed the seiji/haproxy-experimental-flag-forces-bundled branch from 7cdc6f7 to 2f4d555 Compare June 3, 2026 19:46
@eicherseiji eicherseiji added go add ONLY when ready to merge, run all tests release-test release test labels Jun 3, 2026
@eicherseiji eicherseiji marked this pull request as ready for review June 3, 2026 19:53
@eicherseiji eicherseiji requested a review from a team as a code owner June 3, 2026 19:53
@eicherseiji eicherseiji self-assigned this Jun 3, 2026
…rder

With the bundled ray-haproxy binary now resolved before the explicit
RAY_SERVE_HAPROXY_BINARY_PATH override, the explicit-path branch is only
reached when the package is unavailable. The CI/servebuild image has
ray-haproxy installed, so patch ray_haproxy absent in this test to exercise
the override branch.

Signed-off-by: Seiji Eicher <seiji@anyscale.com>
@eicherseiji eicherseiji merged commit d5548ad into ray-project:master Jun 4, 2026
6 checks passed
rueian pushed a commit to rueian/ray that referenced this pull request Jun 4, 2026
…INARY_PATH (ray-project#63829)

## Why

`RAY_SERVE_EXPERIMENTAL_PIP_HAPROXY=1` is supposed to make Ray Serve use
the HAProxy binary bundled in the `ray-haproxy` PyPI package. In
practice it was a **no-op** whenever the runtime image sets
`RAY_SERVE_HAPROXY_BINARY_PATH` — which the Ray images do
(`docker/base-deps/Dockerfile` sets
`RAY_SERVE_HAPROXY_BINARY_PATH=/usr/local/bin/haproxy`).

`_resolve_haproxy_binary()` honored the explicit-path override *before*
trying the bundled wheel, so with the flag on it returned
`/usr/local/bin/haproxy` and never reached the `ray_haproxy` package. As
a result the `*.aws.pip_haproxy` nightly release variants
(`serve_controller_benchmark_haproxy`,
`pytest_serve_autoscaling_load_test`) silently benchmarked the image's
system build, not the pip binary they were meant to validate.

Confirmed from a `pip_haproxy` release run's proxy logs: every proxy
logged `Using HAProxy binary: /usr/local/bin/haproxy`; the wheel path
never appeared.

## What

- Resolve the bundled `ray-haproxy` binary **first**, so the flag takes
precedence over an image-baked `RAY_SERVE_HAPROXY_BINARY_PATH`.
- The explicit-path override and system-PATH fallback are unchanged, and
still apply when the `ray-haproxy` package is unavailable.
- Flag-off (default) behavior is unchanged: return
`RAY_SERVE_HAPROXY_BINARY_PATH` verbatim.

No change needed in `release_tests.yaml`: the existing `pip_haproxy`
variants now actually exercise the pip binary.

## Testing

Existing `python/ray/serve/tests/unit/test_haproxy_binary.py` suite
passes against the new ordering (4 tests). Docstring updated to reflect
the resolution order.

---------

Signed-off-by: Seiji Eicher <seiji@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 release-test release test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants