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] avoid warning when receiving too much logs from a different job #22102

Merged
merged 2 commits into from
Feb 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 14 additions & 18 deletions python/ray/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,6 @@ def __init__(self):
# running on.
self.ray_debugger_external = False
self._load_code_from_local = False
# Used to toggle whether or not logs should be filtered to only those
# produced in the same job.
self.filter_logs_by_job = True

@property
def connected(self):
Expand Down Expand Up @@ -496,6 +493,20 @@ def print_logs(self):
self.threads_stopped.wait(timeout=0.01)
continue

if self.gcs_pubsub_enabled:
data = msg
else:
data = json.loads(ray._private.utils.decode(msg["data"]))

# Don't show logs from other drivers.
if data["job"] and data["job"] != job_id_hex:
num_consecutive_messages_received = 0
last_polling_batch_size = 0
continue

data["localhost"] = localhost
global_worker_stdstream_dispatcher.emit(data)

if self.gcs_pubsub_enabled:
lagging = (
100 <= last_polling_batch_size < subscriber.last_batch_size
Expand All @@ -515,21 +526,6 @@ def print_logs(self):
"'ray.init(log_to_driver=False)'."
)

if self.gcs_pubsub_enabled:
data = msg
else:
data = json.loads(ray._private.utils.decode(msg["data"]))

# Don't show logs from other drivers.
if (
self.filter_logs_by_job
and data["job"]
and job_id_hex != data["job"]
):
continue
data["localhost"] = localhost
global_worker_stdstream_dispatcher.emit(data)

except (OSError, redis.exceptions.ConnectionError) as e:
logger.error(f"print_logs: {e}")
finally:
Expand Down