diff --git a/execution/.gitignore b/execution/.gitignore index d4dceff0274cd6ab3296e85e995f7e5d504f114d..bac9a5d1eeb12d9e40d38376904e8fb69c0e5231 100644 --- a/execution/.gitignore +++ b/execution/.gitignore @@ -1 +1,2 @@ -exp_counter.txt \ No newline at end of file +exp_counter.txt +results diff --git a/execution/lib/cli_parser.py b/execution/lib/cli_parser.py index 0b0a7438910560f5b5871b0023c92d6743dd6cc9..62f1c745cfa40c06dff48be160061da61e41459b 100644 --- a/execution/lib/cli_parser.py +++ b/execution/lib/cli_parser.py @@ -58,6 +58,10 @@ def default_parser(description): metavar='<URL>', default=os.environ.get('PROMETHEUS_BASE_URL'), help='Defines where to find the prometheus instance') + parser.add_argument('--path', + metavar='<path>', + default=os.environ.get('RESULT_PATH', 'results'), + help='A directory path for the results') return parser def benchmark_parser(description): diff --git a/execution/theodolite.py b/execution/theodolite.py index 3c0506355aff373795adb762e0b66ec64456c5df..530b5fa89fb1388fedf3c4e2ee1af52c5f97e6b9 100755 --- a/execution/theodolite.py +++ b/execution/theodolite.py @@ -31,16 +31,20 @@ def load_variables(): def main(uc, loads, instances_list, partitions, cpu_limit, memory_limit, commit_ms, duration, domain_restriction, search_strategy, - prometheus_base_url ,reset, reset_only, namespace): + prometheus_base_url ,reset, reset_only, namespace, result_path): print(f"Domain restriction of search space activated: {domain_restriction}") print(f"Chosen search strategy: {search_strategy}") - if os.path.exists("exp_counter.txt"): - with open("exp_counter.txt", mode="r") as read_stream: + counter_path = f"{result_path}/exp_counter.txt" + + if os.path.exists(counter_path): + with open(counter_path, mode="r") as read_stream: exp_id = int(read_stream.read()) else: exp_id = 0 + # Create the directory if not exists + os.makedirs(result_path, exist_ok=True) # Store metadata separator = "," @@ -56,10 +60,10 @@ def main(uc, loads, instances_list, partitions, cpu_limit, memory_limit, f"DOMAIN_RESTRICTION={domain_restriction}\n", f"SEARCH_STRATEGY={search_strategy}" ] - with open(f"exp{exp_id}_uc{uc}_meta.txt", "w") as stream: + with open(f"{result_path}/exp{exp_id}_uc{uc}_meta.txt", "w") as stream: stream.writelines(lines) - with open("exp_counter.txt", mode="w") as write_stream: + with open(counter_path, mode="w") as write_stream: write_stream.write(str(exp_id + 1)) # domain restriction @@ -177,4 +181,4 @@ if __name__ == '__main__': main(args.uc, args.loads, args.instances_list, args.partitions, args.cpu_limit, args.memory_limit, args.commit_ms, args.duration, args.domain_restriction, args.search_strategy, args.prometheus, - args.reset, args.reset_only, args.namespace) + args.reset, args.reset_only, args.namespace, args.path)