mirror of
https://github.com/wassname/ray.git
synced 2026-09-12 12:51:15 +08:00
[Core] Log output from different jobs to different drivers. (#8885)
* . * . * Correct now * No interactivity errors * format * Filtering * lint * . * No more filtering * Removed interactivity * . * . * . * . * . * . * Redirection works * formatting * something broken? * . * Works * formatting * redirect output * formatting * formatting * Fix file descriptor leakage * format * . * . * . * . * . * Refactor * . * Only run on job switch * . * cleanup * . * ... * Review * . * . * . * . * whoops * . * Should fix bug * . * . * addressed comments * formatting * formatting * Fix typo * . * . * . * . Co-authored-by: Ubuntu <ubuntu@ip-172-31-14-33.us-west-2.compute.internal>
This commit is contained in:
@@ -308,6 +308,19 @@ cdef prepare_args(
|
||||
core_worker.put_serialized_object(serialized_arg)))))
|
||||
|
||||
|
||||
def switch_worker_log_if_needed(worker, next_job_id):
|
||||
if worker.mode != ray.WORKER_MODE:
|
||||
return
|
||||
if (worker.current_logging_job_id is None) or \
|
||||
(worker.current_logging_job_id != next_job_id):
|
||||
job_stdout_path, job_stderr_path = (
|
||||
worker.node.get_job_redirected_log_file(
|
||||
worker.worker_id, next_job_id.binary())
|
||||
)
|
||||
ray.worker.set_log_file(job_stdout_path, job_stderr_path)
|
||||
worker.current_logging_job_id = next_job_id
|
||||
|
||||
|
||||
cdef execute_task(
|
||||
CTaskType task_type,
|
||||
const CRayFunction &ray_function,
|
||||
@@ -444,6 +457,7 @@ cdef execute_task(
|
||||
with core_worker.profile_event(b"task:execute"):
|
||||
task_exception = True
|
||||
try:
|
||||
switch_worker_log_if_needed(worker, job_id)
|
||||
with ray.worker._changeproctitle(title, next_title):
|
||||
outputs = function_executor(*args, **kwargs)
|
||||
task_exception = False
|
||||
|
||||
Reference in New Issue
Block a user