Skip to content

Commit 5df5362

Browse files
committed
Add test
1 parent 6f205ee commit 5df5362

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tests/test_standalone_interactive_communication.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
interface_send,
1313
interface_receive,
1414
SocketInterface,
15+
ExecutorlibSocketError,
1516
)
1617
from executorlib.standalone.serialize import cloudpickle_register
1718
from executorlib.standalone.interactive.spawner import MpiExecSpawner
@@ -114,6 +115,35 @@ def test_interface_serial_with_debug(self):
114115
)
115116
interface.shutdown(wait=True)
116117

118+
def test_interface_serial_with_stopped_process(self):
119+
cloudpickle_register(ind=1)
120+
task_dict = {"fn": calc, "args": (), "kwargs": {"i": 2}}
121+
interface = SocketInterface(
122+
spawner=MpiExecSpawner(cwd=None, cores=1, openmpi_oversubscribe=False),
123+
log_obj_size=True,
124+
)
125+
interface.bootup(
126+
command_lst=[
127+
sys.executable,
128+
os.path.abspath(
129+
os.path.join(
130+
__file__,
131+
"..",
132+
"..",
133+
"executorlib",
134+
"backend",
135+
"interactive_serial.py",
136+
)
137+
),
138+
"--zmqport",
139+
str(interface.bind_to_random_port()),
140+
]
141+
)
142+
interface.send_dict(input_dict=task_dict)
143+
interface._spawner._process.terminate()
144+
with self.assertRaises(ExecutorlibSocketError):
145+
interface.receive_dict()
146+
117147

118148
class TestZMQ(unittest.TestCase):
119149
def test_interface_receive(self):

0 commit comments

Comments
 (0)