@@ -185,3 +185,52 @@ def test_gromacs_repeats(mutable_config, mutable_mock_workspace_path):
185
185
assert "gromacs.water_bare.pme_single_rank" in data
186
186
assert "gromacs.water_bare.pme_single_rank.1" not in data
187
187
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