Skip to content

Conversation

@JasonLi1909
Copy link
Contributor

@JasonLi1909 JasonLi1909 commented Nov 17, 2025

Users have run into issues using the setup_mlflow API with Ray Train V2 enabled:

  • When using setup_mlflow in a tune run, a DeprecationWarning is raised because ray.train.get_context() is called from with a Ray Tune run
  • When using setup_mlflow in a regular Train run, a DeprecationWarning is raised because TrainContext.get_trial_id() is called but this is no longer supported in Train V2

This PR:

  • Makes setup_mlflow compatible with Ray Train V2 by avoiding deprecated API usage
  • Adds tests for testing the compatibility of Train V2 with setup_mlflow

…p_mlflow

Signed-off-by: JasonLi1909 <jasli1909@gmail.com>
@JasonLi1909 JasonLi1909 requested a review from a team as a code owner November 17, 2025 18:13
Copy link
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 aims to add compatibility with Ray Train V2 for the setup_mlflow API by handling deprecation warnings. The changes introduce try-except blocks to catch DeprecationWarning and fall back to alternative APIs or gracefully handle the situation.

While the intent is good, I've found a critical issue where the new structure could lead to a NameError if ray.train.get_context() raises a RuntimeError. I've provided a suggestion to restructure the code to prevent this.

Additionally, I've pointed out that simply catching DeprecationWarning for context methods like get_world_rank() and then proceeding without trial information could lead to silent failures in MLflow logging. It would be better to use the newer APIs if possible.

@ray-gardener ray-gardener bot added the train Ray Train Related Issue label Nov 17, 2025
JasonLi1909 and others added 7 commits November 17, 2025 13:37
Signed-off-by: JasonLi1909 <jasli1909@gmail.com>
Signed-off-by: JasonLi1909 <jasli1909@gmail.com>
Signed-off-by: JasonLi1909 <jasli1909@gmail.com>
Signed-off-by: JasonLi1909 <jasli1909@gmail.com>
Signed-off-by: JasonLi1909 <jasli1909@gmail.com>
Signed-off-by: JasonLi1909 <jasli1909@gmail.com>
Copy link
Contributor

@justinvyu justinvyu left a comment

Choose a reason for hiding this comment

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

Thanks, just a few minor things

JasonLi1909 and others added 3 commits November 18, 2025 16:32
Signed-off-by: JasonLi1909 <jasli1909@gmail.com>
Signed-off-by: JasonLi1909 <jasli1909@gmail.com>
Signed-off-by: JasonLi1909 <jasli1909@gmail.com>
JasonLi1909 and others added 2 commits November 19, 2025 11:52
Signed-off-by: JasonLi1909 <jasli1909@gmail.com>
Copy link
Contributor

@justinvyu justinvyu left a comment

Choose a reason for hiding this comment

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

Thanks!

Co-authored-by: Justin Yu <justinvyu@anyscale.com>
Signed-off-by: Jason Li <57246540+JasonLi1909@users.noreply.github.com>
@justinvyu justinvyu enabled auto-merge (squash) November 20, 2025 19:53
@github-actions github-actions bot added the go add ONLY when ready to merge, run all tests label Nov 20, 2025
@justinvyu justinvyu merged commit ffeec63 into ray-project:master Nov 20, 2025
8 checks passed
400Ping pushed a commit to 400Ping/ray that referenced this pull request Nov 21, 2025
- Makes setup_mlflow compatible with Ray Train V2 by avoiding deprecated
API usage
- Adds tests for testing the compatibility of Train V2 with setup_mlflow

---------

Signed-off-by: JasonLi1909 <jasli1909@gmail.com>
Signed-off-by: Jason Li <57246540+JasonLi1909@users.noreply.github.com>
Co-authored-by: Justin Yu <justinvyu@anyscale.com>
ykdojo pushed a commit to ykdojo/ray that referenced this pull request Nov 27, 2025
- Makes setup_mlflow compatible with Ray Train V2 by avoiding deprecated
API usage
- Adds tests for testing the compatibility of Train V2 with setup_mlflow

---------

Signed-off-by: JasonLi1909 <jasli1909@gmail.com>
Signed-off-by: Jason Li <57246540+JasonLi1909@users.noreply.github.com>
Co-authored-by: Justin Yu <justinvyu@anyscale.com>
Signed-off-by: YK <1811651+ykdojo@users.noreply.github.com>
SheldonTsen pushed a commit to SheldonTsen/ray that referenced this pull request Dec 1, 2025
- Makes setup_mlflow compatible with Ray Train V2 by avoiding deprecated
API usage
- Adds tests for testing the compatibility of Train V2 with setup_mlflow

---------

Signed-off-by: JasonLi1909 <jasli1909@gmail.com>
Signed-off-by: Jason Li <57246540+JasonLi1909@users.noreply.github.com>
Co-authored-by: Justin Yu <justinvyu@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 train Ray Train Related Issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants