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] Persist the Driver Console Log When Job Execution Not Through Job API #49452

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MengjinYan
Copy link
Collaborator

Why are these changes needed?

Currently, when user submitting a Ray job through interactive shell or running a python script, the job's log will be output to the console and will not be persisted anywhere. This causes loss of log information in the case where the user disconnected from the console.

This PR added the logic to persist the log information at the same time, still output the log information to the console. To be specific:

  1. An environment variable RAY_DRIVER_CONSOLE_LOG_TO_FILE will be used as a switch to the behavior. Only when (1) the env var is set to "1" AND (2) The job is not submitted using Job API (meaning both the sys.stderr and sys.stdout are not redirected), will the log be persisted.
  2. The log information will be persisted under the current working directory, with file name console_{datetime (%Y-%m-%d_%H-%M-%S_%f)}.log
  3. During the redirection, the output of stdour and stderr will be redirected to the above file. At the same time, a ConsoleLogTailer will be executed in a thread to tail the console log file and output the logs to the console. The same function used in job log tailing is reused.
  4. Corresponding tests are added as well.

Related issue number

Changes needed on the Ray Core side for https://github.com/anyscale/rayturbo/issues/720

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 :(

(1) Persist the driver stderr and stdout to a console log file in the current working directory;
(2) Tail the console log file and output back to the console

Signed-off-by: Mengjin Yan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant