Skip to content
Snippets Groups Projects
Commit 9add3b03 authored by Björn Vonheiden's avatar Björn Vonheiden
Browse files

Use result folder for exp counter and exp results

Add an option for using a results folder.
This should enable the kuberentes job to safe this to a volume.
parent f519afa8
No related branches found
No related tags found
No related merge requests found
exp_counter.txt exp_counter.txt
results
...@@ -58,6 +58,10 @@ def default_parser(description): ...@@ -58,6 +58,10 @@ def default_parser(description):
metavar='<URL>', metavar='<URL>',
default=os.environ.get('PROMETHEUS_BASE_URL'), default=os.environ.get('PROMETHEUS_BASE_URL'),
help='Defines where to find the prometheus instance') 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 return parser
def benchmark_parser(description): def benchmark_parser(description):
......
...@@ -31,16 +31,20 @@ def load_variables(): ...@@ -31,16 +31,20 @@ def load_variables():
def main(uc, loads, instances_list, partitions, cpu_limit, memory_limit, def main(uc, loads, instances_list, partitions, cpu_limit, memory_limit,
commit_ms, duration, domain_restriction, search_strategy, 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"Domain restriction of search space activated: {domain_restriction}")
print(f"Chosen search strategy: {search_strategy}") print(f"Chosen search strategy: {search_strategy}")
if os.path.exists("exp_counter.txt"): counter_path = f"{result_path}/exp_counter.txt"
with open("exp_counter.txt", mode="r") as read_stream:
if os.path.exists(counter_path):
with open(counter_path, mode="r") as read_stream:
exp_id = int(read_stream.read()) exp_id = int(read_stream.read())
else: else:
exp_id = 0 exp_id = 0
# Create the directory if not exists
os.makedirs(result_path, exist_ok=True)
# Store metadata # Store metadata
separator = "," separator = ","
...@@ -56,10 +60,10 @@ def main(uc, loads, instances_list, partitions, cpu_limit, memory_limit, ...@@ -56,10 +60,10 @@ def main(uc, loads, instances_list, partitions, cpu_limit, memory_limit,
f"DOMAIN_RESTRICTION={domain_restriction}\n", f"DOMAIN_RESTRICTION={domain_restriction}\n",
f"SEARCH_STRATEGY={search_strategy}" 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) 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)) write_stream.write(str(exp_id + 1))
# domain restriction # domain restriction
...@@ -177,4 +181,4 @@ if __name__ == '__main__': ...@@ -177,4 +181,4 @@ if __name__ == '__main__':
main(args.uc, args.loads, args.instances_list, args.partitions, args.cpu_limit, main(args.uc, args.loads, args.instances_list, args.partitions, args.cpu_limit,
args.memory_limit, args.commit_ms, args.duration, args.memory_limit, args.commit_ms, args.duration,
args.domain_restriction, args.search_strategy, args.prometheus, args.domain_restriction, args.search_strategy, args.prometheus,
args.reset, args.reset_only, args.namespace) args.reset, args.reset_only, args.namespace, args.path)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment