Skip to content

Commit b4e38ba

Browse files
committed
tests
1 parent 25a06b8 commit b4e38ba

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

tests/test_slurmclusterexecutor.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@
1414
skip_mpi4py_test = importlib.util.find_spec("mpi4py") is None
1515

1616

17+
submission_template = """\
18+
#!/bin/bash
19+
#SBATCH --output=time.out
20+
#SBATCH --job-name={{job_name}}
21+
#SBATCH --chdir={{working_directory}}
22+
#SBATCH --get-user-env=L
23+
#SBATCH --cpus-per-task={{cores}}
24+
25+
{{command}}
26+
"""
27+
28+
1729
def mpi_funct(i):
1830
from mpi4py import MPI
1931

@@ -29,7 +41,7 @@ def mpi_funct(i):
2941
class TestCacheExecutorPysqa(unittest.TestCase):
3042
def test_executor(self):
3143
with SlurmClusterExecutor(
32-
resource_dict={"cores": 2, "cwd": "executorlib_cache"},
44+
resource_dict={"cores": 2, "cwd": "executorlib_cache", "submission_template": submission_template},
3345
block_allocation=False,
3446
cache_directory="executorlib_cache",
3547
terminate_tasks_on_shutdown=False,
@@ -43,7 +55,7 @@ def test_executor(self):
4355

4456
def test_executor_no_cwd(self):
4557
with SlurmClusterExecutor(
46-
resource_dict={"cores": 2},
58+
resource_dict={"cores": 2, "submission_template": submission_template},
4759
block_allocation=False,
4860
cache_directory="executorlib_cache",
4961
terminate_tasks_on_shutdown=True,
@@ -57,7 +69,7 @@ def test_executor_no_cwd(self):
5769

5870
def test_executor_existing_files(self):
5971
with SlurmClusterExecutor(
60-
resource_dict={"cores": 2, "cwd": "executorlib_cache"},
72+
resource_dict={"cores": 2, "cwd": "executorlib_cache", "submission_template": submission_template},
6173
block_allocation=False,
6274
cache_directory="executorlib_cache",
6375
) as exe:
@@ -75,7 +87,7 @@ def test_executor_existing_files(self):
7587
dump(file_name=task_key, data_dict={"a": 1})
7688

7789
with SlurmClusterExecutor(
78-
resource_dict={"cores": 2, "cwd": "executorlib_cache"},
90+
resource_dict={"cores": 2, "cwd": "executorlib_cache", "submission_template": submission_template},
7991
block_allocation=False,
8092
cache_directory="executorlib_cache",
8193
) as exe:

0 commit comments

Comments
 (0)