-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
In the current implementation, we just receive a single callable, call it, and exit from the agent. But since each connection can actually execute multiple callables, it is really inefficient to re-start the agent process for no reason.
isolate/src/isolate/backends/connections/ipc/agent.py
Lines 107 to 137 in 6587d96
# TODO(feat): this should probably run in a loop instead of | |
# receiving a single function and then exitting immediately. | |
with child_connection(serialization_backend_name, address) as connection: | |
print(f"[trace] Created child connection to {address}") | |
callable = connection.recv() | |
print(f"[trace] Received the callable at {address}") | |
result = None | |
did_it_raise = False | |
try: | |
result = callable() | |
except BaseException as exc: | |
result = exc | |
did_it_raise = True | |
finally: | |
try: | |
connection.send((result, did_it_raise)) | |
except BaseException: | |
if did_it_raise: | |
# If we can't even send it through the connection | |
# still try to dump it to the stderr as the last | |
# resort. | |
import traceback | |
assert isinstance(result, BaseException) | |
traceback.print_exception( | |
type(result), | |
result, | |
result.__traceback__, | |
) | |
raise |
Metadata
Metadata
Assignees
Labels
No labels