From d188becec268511d6c91b65b5a3633479473877d Mon Sep 17 00:00:00 2001 From: Lixin Wei Date: Wed, 19 Aug 2020 02:48:48 +0800 Subject: [PATCH] [Python Worker] Add pid to log file name (#10149) Co-authored-by: Alex Wu --- python/ray/log_monitor.py | 4 ++-- python/ray/node.py | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/python/ray/log_monitor.py b/python/ray/log_monitor.py index 31e83c8c3..91465bccf 100644 --- a/python/ray/log_monitor.py +++ b/python/ray/log_monitor.py @@ -19,8 +19,8 @@ import ray.utils # entry/init points. logger = logging.getLogger(__name__) -# First group is worker id. Second group is job id. -JOB_LOG_PATTERN = re.compile(".*worker-([0-9a-f]{40})-(\d+)") +# The groups are worker id, job id, and pid. +JOB_LOG_PATTERN = re.compile(".*worker-([0-9a-f]{40})-(\d+)-(\d+)") class LogFileInfo: diff --git a/python/ray/node.py b/python/ray/node.py index 9b136de77..97da222a5 100644 --- a/python/ray/node.py +++ b/python/ray/node.py @@ -748,11 +748,12 @@ class Node: return None, None if job_id is not None: - name = "worker-{}-{}".format( + name = "worker-{}-{}-{}".format( ray.utils.binary_to_hex(worker_id), - ray.utils.binary_to_hex(job_id)) + ray.utils.binary_to_hex(job_id), os.getpid()) else: - name = "worker-{}".format(ray.utils.binary_to_hex(worker_id)) + name = "worker-{}-{}".format( + ray.utils.binary_to_hex(worker_id), os.getpid()) worker_stdout_file, worker_stderr_file = self._get_log_file_names( name, unique=False)