Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion executorlib/backend/interactive_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def main() -> None:
if mpi_rank_zero:
interface_send(
socket=socket,
result_dict={"error": error, "error_type": str(type(error))},
result_dict={"error": error},
)
else:
# Send output
Expand Down
2 changes: 1 addition & 1 deletion executorlib/backend/interactive_serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def main(argument_lst: Optional[list[str]] = None):
except Exception as error:
interface_send(
socket=socket,
result_dict={"error": error, "error_type": str(type(error))},
result_dict={"error": error},
)
else:
# Send output
Expand Down
5 changes: 2 additions & 3 deletions executorlib/standalone/interactive/communication.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ def receive_dict(self) -> dict:
if "result" in output:
return output["result"]
else:
error_type = output["error_type"].split("'")[1]
raise eval(error_type)(output["error"])
raise output["error"]

def send_and_receive_dict(self, input_dict: dict) -> dict:
"""
Expand Down Expand Up @@ -181,7 +180,7 @@ def interface_send(socket: Optional[zmq.Socket], result_dict: dict):

Args:
socket (zmq.Socket): socket for the connection
result_dict (dict): dictionary to be sent, supported keys are result, error and error_type.
result_dict (dict): dictionary to be sent, supported keys are result and error.
"""
if socket is not None:
socket.send(cloudpickle.dumps(result_dict))
Expand Down
4 changes: 2 additions & 2 deletions tests/test_backend_interactive_serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_main_as_thread_error(self):
t.start()
submit_error(socket=socket)
self.assertEqual(
cloudpickle.loads(socket.recv())["error_type"], "<class 'TypeError'>"
str(type(cloudpickle.loads(socket.recv())["error"])), "<class 'TypeError'>"
)
self.assertEqual(cloudpickle.loads(socket.recv()), {"result": True})
socket.close()
Expand All @@ -78,7 +78,7 @@ def test_submit_as_thread_error(self):
t.start()
main(argument_lst=["--zmqport", str(port)])
self.assertEqual(
cloudpickle.loads(socket.recv())["error_type"], "<class 'TypeError'>"
str(type(cloudpickle.loads(socket.recv())["error"])), "<class 'TypeError'>"
)
self.assertEqual(cloudpickle.loads(socket.recv()), {"result": True})
socket.close()
Expand Down
Loading