Skip to content

Commit c17fd6f

Browse files
committed
test: Update template tests configuration generation
1 parent c86c4d4 commit c17fd6f

File tree

1 file changed

+25
-28
lines changed

1 file changed

+25
-28
lines changed

tests/generate_template_reference_data.py

+25-28
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
import operator
1010
import os
1111
import sys
12+
from contextlib import redirect_stdout
1213
from hashlib import sha1
1314

1415
import jinja2
1516
import signac
1617
from define_template_test_project import TestProject
17-
from test_project import redirect_stdout
1818

1919
import flow
2020
import flow.environments
@@ -28,11 +28,16 @@
2828
PROJECT_DIRECTORY = '/home/user/path with spaces and "quotes" and \\backslashes/'
2929
MOCK_EXECUTABLE = "/usr/local/bin/python"
3030
DEFAULT_BUNDLES = [
31-
("omp_op", "parallel_op"),
32-
("mpi_op", "op", "memory_op"),
33-
("hybrid_op", "omp_op"),
31+
{"bundles": [("omp_op", "parallel_op")], "parallel": [True, False]},
32+
{"bundles": [("mpi_op", "op", "memory_op")], "parallel": [False]},
33+
{"bundles": [("hybrid_op", "omp_op")], "parallel": [False]},
3434
]
35-
DEFAULT_SETTING = {"bundles": DEFAULT_BUNDLES, "parallel": [True, False]}
35+
36+
37+
def set_bundles(partitions=None):
38+
if partitions is None:
39+
return DEFAULT_BUNDLES
40+
return [{"partition": partitions, **bundle} for bundle in DEFAULT_BUNDLES]
3641

3742

3843
def cartesian(**kwargs):
@@ -71,45 +76,37 @@ def init(project):
7176
environments = {
7277
"environment.StandardEnvironment": [],
7378
"environments.xsede.Bridges2Environment": [
74-
{
75-
"partition": ["RM", "RM-shared", "GPU", "GPU-shared"],
76-
},
77-
{"partition": ["RM"], **DEFAULT_SETTING},
79+
{"partition": ["RM", "RM-shared", "GPU", "GPU-shared"]},
80+
*set_bundles(["RM"]),
7881
],
7982
"environments.umich.GreatLakesEnvironment": [
80-
{
81-
"partition": ["standard", "gpu", "gpu_mig40"],
82-
},
83-
DEFAULT_SETTING,
83+
{"partition": ["standard", "gpu", "gpu_mig40"]},
84+
*set_bundles(),
8485
],
85-
"environments.incite.SummitEnvironment": [{}, DEFAULT_SETTING],
86+
"environments.incite.SummitEnvironment": [{}, *set_bundles()],
8687
"environments.incite.AndesEnvironment": [
8788
{"partition": ["batch", "gpu"]},
88-
{"partition": ["batch"], **DEFAULT_SETTING},
89+
*set_bundles(["batch"]),
8990
],
90-
"environments.umn.MangiEnvironment": [{}, DEFAULT_SETTING],
91+
"environments.umn.MangiEnvironment": [{}, *set_bundles()],
9192
"environments.xsede.ExpanseEnvironment": [
9293
{
9394
"partition": ["compute", "shared", "gpu", "gpu-shared", "large-shared"],
9495
},
95-
{"partition": ["compute"], **DEFAULT_SETTING},
96+
*set_bundles(["compute"]),
9697
],
9798
"environments.drexel.PicotteEnvironment": [
98-
{
99-
"partition": ["def", "gpu"],
100-
},
101-
{"partition": ["def"], **DEFAULT_SETTING},
99+
{"partition": ["def", "gpu"]},
100+
*set_bundles(["def"]),
102101
],
103102
"environments.xsede.DeltaEnvironment": [
104-
{
105-
"partition": ["cpu", "gpuA40x4", "gpuA100x4"],
106-
},
107-
{"partition": ["cpu"], **DEFAULT_SETTING},
103+
{"partition": ["cpu", "gpuA40x4", "gpuA100x4"]},
104+
*set_bundles(["cpu"]),
108105
],
109-
"environments.incite.CrusherEnvironment": [{}, DEFAULT_SETTING],
106+
"environments.incite.CrusherEnvironment": [{}, *set_bundles()],
110107
# Frontier cannot use partitions as logic requires gpu
111108
# in the name of partitions that are gpu nodes.
112-
"environments.incite.FrontierEnvironment": [{}, DEFAULT_SETTING],
109+
"environments.incite.FrontierEnvironment": [{}, *set_bundles()],
113110
"environments.purdue.AnvilEnvironment": [
114111
{
115112
"partition": [
@@ -122,7 +119,7 @@ def init(project):
122119
"gpu",
123120
],
124121
},
125-
{"partition": ["wholenode"], **DEFAULT_SETTING},
122+
*set_bundles(["wholenode"]),
126123
],
127124
}
128125

0 commit comments

Comments
 (0)