Skip to content

Commit

Permalink
fix(agent): print serialization exceptions instead of logging (#144)
Browse files Browse the repository at this point in the history
* fix(agent): print serialization exceptions instead of logging

* fix(agent): don't forget newlines when logging
  • Loading branch information
efiop authored Jun 6, 2024
1 parent 7f4eadc commit 540d14f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/isolate/connections/grpc/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
from isolate.connections.grpc import definitions
from isolate.connections.grpc.configuration import get_default_options
from isolate.connections.grpc.interface import from_grpc
from isolate.logger import logger
from isolate.logs import LogLevel, LogSource


@dataclass
Expand Down Expand Up @@ -117,7 +115,7 @@ def execute_function(
# depickling is basically involves code execution from the *user*.
function = from_grpc(function)
except SerializationError:
self.log(traceback.format_exc())
traceback.print_exc()
raise AbortException(
f"The {function_kind} function could not be deserialized."
)
Expand Down Expand Up @@ -154,7 +152,8 @@ def send_object(
definition = serialize_object(serialization_method, result)
except SerializationError:
if stringized_tb:
logger.log(LogLevel.ERROR, stringized_tb, LogSource.BRIDGE)
print(stringized_tb, file=sys.stderr)
self.log(traceback.format_exc())
raise AbortException(
"Error while serializing the execution result "
f"(object of type {type(result)})."
Expand All @@ -179,7 +178,7 @@ def send_object(
)

def log(self, message: str) -> None:
self._log.write(message)
self._log.write(message + "\n")
self._log.flush()

def abort_with_msg(
Expand Down

0 comments on commit 540d14f

Please sign in to comment.