Skip to content

Commit 69ccf00

Browse files
authored
Add test for execute_with_pysqa() (#741)
* Add test for execute_with_pysqa() * Update test_fluxclusterexecutor.py * extend test
1 parent c7d9c4b commit 69ccf00

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

tests/test_fluxclusterexecutor.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
import importlib
33
import unittest
44
import shutil
5+
from time import sleep
56

67
from executorlib import FluxClusterExecutor
78
from executorlib.standalone.serialize import cloudpickle_register
89

910
try:
1011
import flux.job
1112
from executorlib.task_scheduler.file.hdf import dump
12-
from executorlib.task_scheduler.file.queue_spawner import terminate_with_pysqa, terminate_tasks_in_cache
13+
from executorlib.task_scheduler.file.queue_spawner import terminate_with_pysqa, terminate_tasks_in_cache, execute_with_pysqa
14+
from executorlib.task_scheduler.file.shared import _get_execute_command
1315

1416
skip_flux_test = "FLUX_URI" not in os.environ
1517
pmi = os.environ.get("EXECUTORLIB_PMIX", None)
@@ -59,8 +61,19 @@ def test_executor_no_cwd(self):
5961
self.assertEqual(len(os.listdir("executorlib_cache")), 2)
6062
self.assertTrue(fs1.done())
6163

62-
def test_terminate_with_pysqa(self):
63-
self.assertIsNone(terminate_with_pysqa(queue_id=1, backend="flux"))
64+
def test_pysqa_interface(self):
65+
queue_id = execute_with_pysqa(
66+
command=_get_execute_command(
67+
file_name="test_i.h5",
68+
cores=1,
69+
),
70+
file_name="test_i.h5",
71+
data_dict={"fn": sleep, "args": (10,)},
72+
resource_dict={"cores": 1},
73+
cache_directory="executorlib_cache",
74+
backend="flux"
75+
)
76+
self.assertIsNone(terminate_with_pysqa(queue_id=queue_id, backend="flux"))
6477

6578
def test_executor_existing_files(self):
6679
with FluxClusterExecutor(

0 commit comments

Comments
 (0)