Skip to content

Conversation

TimothySeah
Copy link
Contributor

@TimothySeah TimothySeah commented May 13, 2025

Provide env vars to enable/disable structured logging on controller and worker processes.

Verified on ray train v2 on Anyscale with the pytorch example: https://docs.ray.io/en/latest/train/getting-started-pytorch.html.

With no environment variables set the controller and worker logs look like this
Screenshot 2025-05-14 at 3 18 26 PM
Screenshot 2025-05-14 at 3 18 50 PM

with the environment variables set the controller and worker logs look like this (note how there are no controller logs at all)
Screenshot 2025-05-14 at 8 25 22 PM
Screenshot 2025-05-14 at 8 25 50 PM

@TimothySeah TimothySeah added the go add ONLY when ready to merge, run all tests label May 13, 2025
@hainesmichaelc hainesmichaelc added the community-contribution Contributed by the community label May 15, 2025
@TimothySeah TimothySeah marked this pull request as ready for review May 15, 2025 17:46
@masoudcharkhabi masoudcharkhabi added the train Ray Train Related Issue label May 15, 2025
Comment on lines 107 to 108
@pytest.mark.parametrize("context", [get_dummy_run_context()])
def test_controller_sys_not_logged_to_file(controller_logging, context):
Copy link
Contributor

Choose a reason for hiding this comment

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

can you make this a @pytest.mark.parametrize("configure_logging", [True, False])?

And also, can you do a driveby change to convert the current "context" parameter to just a regular fixture since it's always a single value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Converted context - lmk if this is what you had in mind since I'm new to pytest.

I initially tried can you make this a @pytest.mark.parametrize("configure_logging", [True, False]) but decided against it because the branching logic (toggling whether we call configure_controller_logger and then assert contents vs assert raises) is even more lines of code. Lmk what you think.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think I prefer these 2 tests to be packaged in the same method even if it's more lines of code, to make it clear that the 2nd case is the omission of the call to configure_x_logging. But I'm not going to block merge on this nit

@TimothySeah TimothySeah requested a review from justinvyu May 16, 2025 22:06
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!

Comment on lines 107 to 108
@pytest.mark.parametrize("context", [get_dummy_run_context()])
def test_controller_sys_not_logged_to_file(controller_logging, context):
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I prefer these 2 tests to be packaged in the same method even if it's more lines of code, to make it clear that the 2nd case is the omission of the call to configure_x_logging. But I'm not going to block merge on this nit

@TimothySeah TimothySeah requested a review from justinvyu May 20, 2025 01:42
@matthewdeng matthewdeng removed the community-contribution Contributed by the community label May 20, 2025
@matthewdeng matthewdeng merged commit 27899ba into ray-project:master May 20, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community-backlog 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.

5 participants