Skip to content

[train] Add log line before launching training function - #62911

Merged
matthewdeng merged 6 commits into
ray-project:masterfrom
jade710:patch-1
May 12, 2026
Merged

matthewdeng merged 6 commits into
ray-project:masterfrom
jade710:patch-1

Conversation

@jade710

@jade710 jade710 commented Apr 24, 2026 •

Copy link
Copy Markdown
Contributor

Why are these changes needed?

There is currently no log signal indicating when train_func() is about to be invoked on a worker. The last framework-emitted log line before the user's training function runs is "Setting up process group..." from _setup_torch_process_group, which happens before init_process_group() completes — a potentially long collective barrier.

This makes it impossible to distinguish (from logs alone) whether a worker is stuck at init_process_group or has entered the user's training function but hasn't logged yet.

This one-line change adds an INFO log right before the training thread is started, providing a clear marker that the training function is about to execute.

## Why are these changes needed?

There is currently no log signal indicating when `train_func()` is about to be invoked on a worker. The last framework-emitted log line before the user's training function runs is "Setting up process group..." from `_setup_torch_process_group`, which happens *before* `init_process_group()` completes — a potentially long collective barrier.

This makes it impossible to distinguish (from logs alone) whether a worker is stuck at `init_process_group` or has entered the user's training function but hasn't logged yet.

This one-line change adds an INFO log right before the training thread is started, providing a clear marker that the training function is about to execute.


Signed-off-by: YQ <[email protected]>
@jade710
jade710 requested a review from a team as a code owner April 24, 2026 16:18

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

Copy link
Copy Markdown
Contributor

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 adds a log message to signal the launch of the training function in the Ray Train worker. The review feedback suggests enhancing this log by including the worker's rank to improve observability in distributed environments and notes that the newly added blank lines contain trailing whitespace which should be removed.

jade710 and others added 3 commits April 24, 2026 09:22
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: YQ <[email protected]>
@ray-gardener ray-gardener Bot added train Ray Train Related Issue observability Issues related to the Ray Dashboard, Logging, Metrics, Tracing, and/or Profiling community-contribution Contributed by the community labels Apr 24, 2026
@github-actions

github-actions Bot commented May 9, 2026

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had
any activity for 14 days. It will be closed in another 14 days if no further activity occurs.
Thank you for your contributions.

You can always ask for help on our discussion forum or Ray's public slack channel.

If you'd like to keep this open, just leave any comment, and the stale label will be removed.

@github-actions github-actions Bot added the stale The issue is stale. It will be closed within 7 days unless there are further conversation label May 9, 2026
@github-actions github-actions Bot added unstale A PR that has been marked unstale. It will not get marked stale again if this label is on it. and removed stale The issue is stale. It will be closed within 7 days unless there are further conversation labels May 12, 2026
Signed-off-by: Mark Towers <[email protected]>
@pseudo-rnd-thoughts pseudo-rnd-thoughts added the go add ONLY when ready to merge, run all tests label May 12, 2026

@pseudo-rnd-thoughts pseudo-rnd-thoughts left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the PR, I agree with the intention. I've just changed this to debug to minimise logs as I suspect this is a debug level only piece of information.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 0bacc0c. Configure here.

# Create and start the training thread.
logger.debug(
f"Rank {get_train_context().get_world_rank()}: Launching training function."
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Log level is debug instead of intended info

Medium Severity

The PR description states this change "adds an INFO log" to provide a clear console-visible marker before launching the training function, but logger.debug is used instead of logger.info. The console handler applies TrainLogLevelFilter which defaults to INFO level, so this DEBUG message won't appear in console output — only in the system log file. Since the "Setting up process group" message it's meant to pair with uses logger.info (for rank 0), this message is effectively invisible in the primary debugging surface, defeating the stated purpose of the change.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0bacc0c. Configure here.

@matthewdeng
matthewdeng merged commit 2d9c453 into ray-project:master May 12, 2026
4 checks passed
Lucas61000 pushed a commit to Lucas61000/ray that referenced this pull request May 15, 2026
…62911)

## Why are these changes needed?

There is currently no log signal indicating when `train_func()` is about
to be invoked on a worker. The last framework-emitted log line before
the user's training function runs is "Setting up process group..." from
`_setup_torch_process_group`, which happens *before*
`init_process_group()` completes — a potentially long collective
barrier.

This makes it impossible to distinguish (from logs alone) whether a
worker is stuck at `init_process_group` or has entered the user's
training function but hasn't logged yet.

This one-line change adds an INFO log right before the training thread
is started, providing a clear marker that the training function is about
to execute.

---------

Signed-off-by: YQ <[email protected]>
Signed-off-by: Mark Towers <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Mark Towers <[email protected]>
alexandrplashchinsky pushed a commit to alexandrplashchinsky/ray-alex that referenced this pull request May 29, 2026
…62911)

## Why are these changes needed?

There is currently no log signal indicating when `train_func()` is about
to be invoked on a worker. The last framework-emitted log line before
the user's training function runs is "Setting up process group..." from
`_setup_torch_process_group`, which happens *before*
`init_process_group()` completes — a potentially long collective
barrier.

This makes it impossible to distinguish (from logs alone) whether a
worker is stuck at `init_process_group` or has entered the user's
training function but hasn't logged yet.

This one-line change adds an INFO log right before the training thread
is started, providing a clear marker that the training function is about
to execute.

---------

Signed-off-by: YQ <[email protected]>
Signed-off-by: Mark Towers <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Mark Towers <[email protected]>
Signed-off-by: Alexandr Plashchinsky <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Contributed by the community go add ONLY when ready to merge, run all tests observability Issues related to the Ray Dashboard, Logging, Metrics, Tracing, and/or Profiling train Ray Train Related Issue unstale A PR that has been marked unstale. It will not get marked stale again if this label is on it.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants