Skip to content

Commit 9b5170e

Browse files
committed
Fix up stat calclation to skip failed experiments
1 parent f80af90 commit 9b5170e

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

lib/ramble/ramble/application.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1990,7 +1990,7 @@ def is_numeric_fom(fom):
19901990
continue
19911991

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

19961996
if exp_inst.result.contexts:

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

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

0 commit comments

Comments
 (0)