Skip to content

Commit cc573ae

Browse files
committed
try different tests
1 parent 8531773 commit cc573ae

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/test_fluxclusterexecutor.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,32 @@ def test_executor_blockallocation_echo(self):
9595
self.assertTrue(fs1.done())
9696
self.assertTrue(fs2.done())
9797

98+
def test_executor_cancel_future_on_shutdown(self):
99+
with FluxClusterExecutor(
100+
resource_dict={"cores": 1, "cwd": "executorlib_cache"},
101+
block_allocation=False,
102+
cache_directory="executorlib_cache",
103+
pmi_mode=pmi,
104+
cancel_futures_on_shutdown=True,
105+
) as exe:
106+
cloudpickle_register(ind=1)
107+
fs1 = exe.submit(echo, 1)
108+
self.assertFalse(fs1.done())
109+
self.assertTrue(fs1.cancelled())
110+
sleep(2)
111+
with FluxClusterExecutor(
112+
resource_dict={"cores": 1, "cwd": "executorlib_cache"},
113+
block_allocation=False,
114+
cache_directory="executorlib_cache",
115+
pmi_mode=pmi,
116+
cancel_futures_on_shutdown=True,
117+
) as exe:
118+
cloudpickle_register(ind=1)
119+
fs1 = exe.submit(echo, 1)
120+
self.assertEqual(fs1.result(), 1)
121+
self.assertEqual(len(os.listdir("executorlib_cache")), 4)
122+
self.assertTrue(fs1.done())
123+
98124
def test_executor_no_cwd(self):
99125
with FluxClusterExecutor(
100126
resource_dict={"cores": 2},

0 commit comments

Comments
 (0)