Skip to content

Commit fb1eeeb

Browse files
Merge pull request #945 from linsword13/stats
Fix up stat calclation to skip failed experiments
2 parents 4bd8b94 + 9b5170e commit fb1eeeb

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

lib/ramble/ramble/application.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1987,7 +1987,7 @@ def is_numeric_fom(fom):
19871987
continue
19881988

19891989
# When strict success is off for repeats (loose success), skip failed exps
1990-
if exp_inst.result.status == experiment_status.FAILED:
1990+
if exp_inst.result.status == experiment_status.FAILED.name:
19911991
continue
19921992

19931993
if exp_inst.result.contexts:

lib/ramble/ramble/test/end_to_end/experiment_repeats.py

+49
Original file line numberDiff line numberDiff line change
@@ -184,3 +184,52 @@ def test_gromacs_repeats(mutable_config, mutable_mock_workspace_path):
184184
assert "gromacs.water_bare.pme_single_rank" in data
185185
assert "gromacs.water_bare.pme_single_rank.1" not in data
186186
assert "gromacs.water_bare.pme_single_rank.2" not in data
187+
188+
189+
@pytest.mark.long
190+
def test_repeat_stats(mutable_config, mutable_mock_workspace_path, request):
191+
test_config = """
192+
ramble:
193+
variables:
194+
n_nodes: 1
195+
processes_per_node: 1
196+
mpi_command: ''
197+
batch_submit: '{execute_experiment}'
198+
applications:
199+
sleep:
200+
workloads:
201+
sleep:
202+
experiments:
203+
sleep_test:
204+
n_repeats: 3
205+
"""
206+
workspace_name = request.node.name
207+
with ramble.workspace.create(workspace_name) as ws:
208+
ws.write()
209+
config_path = os.path.join(ws.config_dir, ramble.workspace.config_file_name)
210+
with open(config_path, "w+") as f:
211+
f.write(test_config)
212+
ws._re_read()
213+
214+
workspace("setup", "--dry-run", global_args=["-w", workspace_name])
215+
216+
base_exp_dir = os.path.join(ws.root, "experiments", "sleep", "sleep", "sleep_test")
217+
for r in range(1, 4):
218+
dir = f"{base_exp_dir}.{r}"
219+
log_path = os.path.join(dir, f"{os.path.basename(dir)}.out")
220+
with open(log_path, "w+") as f:
221+
f.write(f"{r}:0.0elapsed\n")
222+
# Purposely fail the last experiment
223+
if r != 3:
224+
f.write(f"Sleep for {60 * r} seconds\n")
225+
226+
workspace("analyze", "-s", global_args=["-w", workspace_name])
227+
result_file = glob.glob(os.path.join(ws.root, "results.latest.txt"))[0]
228+
with open(result_file) as f:
229+
data = f.read()
230+
assert "summary::n_total_repeats = 3 repeats" in data
231+
assert "summary::n_successful_repeats = 2 repeats" in data
232+
assert "summary::min = 1.0 minutes" in data
233+
# Assert that the last experiment is not included in the stats
234+
assert "summary::max = 2.0 minutes" in data
235+
assert "summary::mean = 1.5 minutes" in data

0 commit comments

Comments
 (0)