Skip to content

[core] Rotate log monitor#51573

Merged
jjyao merged 16 commits intoray-project:masterfrom
dentiny:hjiang/rotate-monitor-logging
Mar 28, 2025
Merged

[core] Rotate log monitor#51573
jjyao merged 16 commits intoray-project:masterfrom
dentiny:hjiang/rotate-monitor-logging

Conversation

@dentiny
Copy link
Contributor

@dentiny dentiny commented Mar 21, 2025

This PR rotates for log monitor via stream redirection utils.

@dentiny dentiny force-pushed the hjiang/rotate-monitor-logging branch from 6763f18 to 064ce19 Compare March 21, 2025 02:00
Signed-off-by: dentiny <dentinyhao@gmail.com>
@dentiny dentiny force-pushed the hjiang/rotate-monitor-logging branch from 064ce19 to cb286eb Compare March 21, 2025 02:00
@dentiny dentiny added the go add ONLY when ready to merge, run all tests label Mar 21, 2025
@dentiny dentiny changed the title rotate log monitor [WIP] rotate log monitor Mar 21, 2025
dentiny added 8 commits March 21, 2025 20:36
Signed-off-by: dentiny <dentinyhao@gmail.com>
Signed-off-by: dentiny <dentinyhao@gmail.com>
Signed-off-by: dentiny <dentinyhao@gmail.com>
Signed-off-by: dentiny <dentinyhao@gmail.com>
Signed-off-by: dentiny <dentinyhao@gmail.com>
Signed-off-by: dentiny <dentinyhao@gmail.com>
@dentiny dentiny changed the title [WIP] rotate log monitor [WIP] [core] Rotate log monitor Mar 27, 2025
@dentiny dentiny requested a review from jjyao March 28, 2025 05:19
@dentiny dentiny changed the title [WIP] [core] Rotate log monitor [core] Rotate log monitor Mar 28, 2025
Copy link
Collaborator

@jjyao jjyao left a comment

Choose a reason for hiding this comment

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

Have you tested locally to see if it's working?

Comment on lines +604 to +613
# Setup stdout/stderr redirect files
stdout_fileno = sys.stdout.fileno()
stderr_fileno = sys.stderr.fileno()
# We also manually set sys.stdout and sys.stderr because that seems to
# have an effect on the output buffering. Without doing this, stdout
# and stderr are heavily buffered resulting in seemingly lost logging
# statements. We never want to close the stdout file descriptor, dup2 will
# close it when necessary and we don't want python's GC to close it.
sys.stdout = open_log(stdout_fileno, unbuffered=True, closefd=False)
sys.stderr = open_log(stderr_fileno, unbuffered=True, closefd=False)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This happens multiple times in the code base, lets make a shared function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I understand, can I do it when all components rotated and merged?

Copy link
Collaborator

Choose a reason for hiding this comment

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

sure

@dentiny
Copy link
Contributor Author

dentiny commented Mar 28, 2025

Have you tested locally to see if it's working?

Unit tests fail on my local, and I get the same error for main branch, but somehow pass on CI.

Signed-off-by: dentiny <dentinyhao@gmail.com>
@dentiny dentiny requested a review from jjyao March 28, 2025 05:44
@jjyao jjyao merged commit 7f0871e into ray-project:master Mar 28, 2025
5 checks passed
f"--gcs-address={gcs_address}",
f"--logging-rotate-bytes={max_bytes}",
f"--logging-rotate-backup-count={backup_count}",
f"--logging-filename={logs_dir}/log_monitor.log",
Copy link
Collaborator

Choose a reason for hiding this comment

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

actually this line is not needed, can you create a follow-up to delete it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

justinrmiller pushed a commit to justinrmiller/ray that referenced this pull request Mar 30, 2025
Signed-off-by: dentiny <dentinyhao@gmail.com>
Signed-off-by: Justin Miller <justinrmiller@gmail.com>
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments