Skip to content

Commit eaad8ae

Browse files
committed
Add more tests
1 parent 3a7f8af commit eaad8ae

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

tests/unit/executor/test_flux_cluster.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,27 @@
2525
skip_mpi4py_test = importlib.util.find_spec("mpi4py") is None
2626

2727

28+
template = """\
29+
#!/bin/bash
30+
# flux: --job-name={{job_name}}
31+
# flux: --env=CORES={{cores}}
32+
# flux: --output=time.out
33+
# flux: --error=error.out
34+
# flux: --nslots={{cores}}
35+
# flux: --queue={{queue}}
36+
{%- if run_time_max %}
37+
# flux: --time-limit={{run_time_max}}s
38+
{%- endif %}
39+
{%- if dependency_list %}
40+
{%- for jobid in dependency_list %}
41+
# flux: --dependency=afterok:{{jobid}}
42+
{%- endfor %}
43+
{%- endif %}
44+
45+
{{command}}
46+
"""
47+
48+
2849
def echo(i):
2950
sleep(1)
3051
return i
@@ -71,6 +92,23 @@ def test_executor(self):
7192
self.assertEqual(len(os.listdir("executorlib_cache")), 4)
7293
self.assertTrue(fs1.done())
7394

95+
def test_executor_wrong_queue_name(self):
96+
with self.assertRaises(ValueError):
97+
with FluxClusterExecutor(
98+
resource_dict={
99+
"cores": 2,
100+
"cwd": "executorlib_cache",
101+
"submission_template": template,
102+
"queue": "test",
103+
},
104+
block_allocation=False,
105+
cache_directory="executorlib_cache",
106+
pmi_mode=pmi,
107+
) as exe:
108+
cloudpickle_register(ind=1)
109+
fs1 = exe.submit(mpi_funct, 1)
110+
print(fs1.result())
111+
74112
def test_executor_no_cwd(self):
75113
with FluxClusterExecutor(
76114
resource_dict={"cores": 2},

0 commit comments

Comments
 (0)