diff --git a/run-exp.py b/run-exp.py index 83e3103b69893af17b953c1debf3ada7b056ca21..6eda8734591930306b37e129f245dfb01fa8df8a 100755 --- a/run-exp.py +++ b/run-exp.py @@ -241,11 +241,24 @@ def main(config_file, global_timeout, dry_run): print(f"> and {c.repetitions} repetitions") print() - variable_map = {v.name: v.evaluate({}) for v in c.variables} - value_combinations = itertools.product(*variable_map.values()) - run_values = [dict(zip(variable_map.keys(), vals)) for vals in value_combinations] + # we precompute all variable values to be able to abort early in case of a problem, + # for instance, if a file does not exist + variable_maps = [{}] - for variables in run_values: + for variable in c.variables: + updated_variable_maps = [] + + for variable_map in variable_maps: + values = variable.evaluate(variable_map) + + for value in values: + updated_map = variable_map.copy() + updated_map[variable.name] = value + updated_variable_maps.append(updated_map) + + variable_maps = updated_variable_maps + + for variables in variable_maps: print() print("Running tasks with variable map: ") print(variables)