Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core][observability] Logs are duplicated if multiple nodes are running on same machine #48676

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kevin85421
Copy link
Member

@kevin85421 kevin85421 commented Nov 9, 2024

Why are these changes needed?

Each Ray node has a LogMonitor, which watches logs under /tmp/ray/$session_name/logs and publishes them to GCS so that the driver process can access the logs.

However, when we launch two Ray nodes on a single host, both LogMonitor watch the same directory /tmp/ray/$session_name/logs.

Related issue number

Closes #48642

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(
# example.py
import ray

@ray.remote
def foo():
    print('hello')


if __name__ == '__main__':
    ray.init()
    handle = foo.remote()
    ray.get(handle)
  • Without this PR
    Screenshot 2024-11-09 at 12 14 08 PM

  • With this PR
    Screenshot 2024-11-09 at 12 15 09 PM

Signed-off-by: kaihsun <kaihsun@anyscale.com>
@kevin85421 kevin85421 changed the title [core] Logs are duplicated if multiple nodes are running on same machine [core][observability] Logs are duplicated if multiple nodes are running on same machine Nov 9, 2024
@kevin85421 kevin85421 marked this pull request as ready for review November 9, 2024 20:16
@jjyao jjyao added the go add ONLY when ready to merge, run all tests label Nov 12, 2024
Comment on lines 1081 to 1082
filename = ray_constants.LOG_MONITOR_LOG_FILE_NAME
file_path = os.path.join(self._logs_dir, filename)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This file won't exist if redict_logging is False?

Copy link
Member Author

@kevin85421 kevin85421 Nov 17, 2024

Choose a reason for hiding this comment

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

In which case will this happen?

Case 1: Do you mean setting RAY_LOG_TO_STDERR=1 for the head node and RAY_LOG_TO_STDERR=0 for the worker nodes? I am not sure what the expected behavior is for this. Should we redirect the logs to the driver process or not?

RAY_LOG_TO_STDERR=1 ray start --head --include-dashboard=True
ray start --address=127.0.0.1:6379

# Try to schedule the task to the worker node
python3 example.py

Case 2:

ray start --head --include-dashboard=True
ray start --address=127.0.0.1:6379
RAY_LOG_TO_STDERR=1 python3 example.py

log_monitor.log will be created by ray start --head --include-dashboard=True.

Copy link
Member Author

Choose a reason for hiding this comment

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

RAY_LOG_TO_STDERR=1 ray start --head --include-dashboard=True

The above command will create the following log files. However, checking other log files seems a bit weird.

image

Copy link
Member Author

Choose a reason for hiding this comment

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

If we plan to handle this case, how about creating an empty file named is_head in the log directory? The worker node can check whether the file exists to decide whether to launch the log monitor process.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated

Signed-off-by: kaihsun <kaihsun@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.

[Core] Logs are duplicated if multiple nodes are running on same machine
3 participants