Skip to content
Snippets Groups Projects
Commit 5d4e5248 authored by Christopher Spinrath's avatar Christopher Spinrath
Browse files

Support variable substitutions in variable definitions

parent 6bd00067
No related branches found
No related tags found
No related merge requests found
...@@ -241,11 +241,24 @@ def main(config_file, global_timeout, dry_run): ...@@ -241,11 +241,24 @@ def main(config_file, global_timeout, dry_run):
print(f"> and {c.repetitions} repetitions") print(f"> and {c.repetitions} repetitions")
print() print()
variable_map = {v.name: v.evaluate({}) for v in c.variables} # we precompute all variable values to be able to abort early in case of a problem,
value_combinations = itertools.product(*variable_map.values()) # for instance, if a file does not exist
run_values = [dict(zip(variable_map.keys(), vals)) for vals in value_combinations] 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()
print("Running tasks with variable map: ") print("Running tasks with variable map: ")
print(variables) print(variables)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment