oap-project / raydp

RayDP provides simple APIs for running Spark on Ray and integrating Spark with AI libraries.
Apache License 2.0
308 stars 68 forks source link

Prepend ":job_id:<jobid>" to java-worker-<jobid>-<pid>.log to avoid too many executor logs flushed to shell console #321

Closed jiafuzha closed 1 year ago

jiafuzha commented 1 year ago

In ray 2.3, there is PR to get real job id from log file content instead of log file name. Check log_monitor.py. If there is not job id (pattern: ":job_id:") found, then job_id field of log message object is None. For log message without job_id set, ray just blindly prints it out in console.

After adding below code snippet in "premain" method of Java agent introduced in #318 , raydp just performs consistently across different ray versions. No executor logs being flushed to console.

String jobId = System.getenv("RAY_JOB_ID"); String rayAddress = System.getProperty("ray.address"); if (jobId != null && rayAddress != null) { try (FileWriter writer = new FileWriter(logDir + "/java-worker-" + jobId + "-" + pid + ".log")) { writer.write(":job_id:" + jobId + "\n"); } }

jiafuzha commented 1 year ago

merged in https://github.com/oap-project/raydp/pull/323