Skip to content

Commit

Permalink
Avoid printing too many messages in Oscar (#2871)
Browse files Browse the repository at this point in the history
  • Loading branch information
chaokunyang authored Mar 25, 2022
1 parent 4ad5491 commit 674cdf2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion mars/oscar/backends/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,10 @@ async def send(
profiling_context=profiling_context,
)

# use `%.500` to avoid print too long messages
with debug_async_timeout(
"actor_call_timeout",
"Calling %r on %s at %s timed out",
"Calling %.500r on %s at %s timed out",
message.content,
actor_ref.uid,
actor_ref.address,
Expand Down
3 changes: 2 additions & 1 deletion mars/oscar/backends/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,10 @@ async def process_message(self, message: _MessageBase, channel: Channel):
with _ErrorProcessor(
self.external_address, message.message_id, message.protocol
) as processor:
# use `%.500` to avoid print too long messages
with debug_async_timeout(
"process_message_timeout",
"Process message %s of channel %s timeout.",
"Process message %.500s of channel %s timeout.",
message,
channel,
):
Expand Down
3 changes: 2 additions & 1 deletion mars/oscar/backends/ray/communication.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,9 @@ async def recv(self):
try:
# Wait on ray object ref
message, object_ref = await self._in_queue.get()
# use `%.500` to avoid print too long messages
with debug_async_timeout(
"ray_object_retrieval_timeout", "Client sent message is %s", message
"ray_object_retrieval_timeout", "Client sent message is %.500s", message
):
result = await object_ref
if isinstance(result, RayChannelException):
Expand Down
3 changes: 2 additions & 1 deletion mars/oscar/core.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,8 @@ cdef class _BaseActor:
except Exception as ex:
if _log_unhandled_errors:
from .debug import logger as debug_logger
debug_logger.exception('Got unhandled error when handling message %r '
# use `%.500` to avoid print too long messages
debug_logger.exception('Got unhandled error when handling message %.500r '
'in actor %s at %s', message, self.uid, self.address)
raise ex

Expand Down

0 comments on commit 674cdf2

Please sign in to comment.