Skip to content
Snippets Groups Projects
Commit d945fc13 authored by Björn Vonheiden's avatar Björn Vonheiden Committed by Sören Henning
Browse files

Get prometheus url in run uc for the lag analysis

parent 888c9421
No related branches found
No related tags found
No related merge requests found
...@@ -50,6 +50,10 @@ def default_parser(description): ...@@ -50,6 +50,10 @@ def default_parser(description):
parser.add_argument('--reset-only', parser.add_argument('--reset-only',
action="store_true", action="store_true",
help='Only resets the environment. Ignores all other parameters') help='Only resets the environment. Ignores all other parameters')
parser.add_argument('--prometheus',
metavar='<URL>',
default=os.environ.get('PROMETHEUS_BASE_URL'),
help='Defines where to find the prometheus instance')
return parser return parser
def benchmark_parser(description): def benchmark_parser(description):
......
...@@ -4,7 +4,7 @@ from kubernetes import client, config # kubernetes api ...@@ -4,7 +4,7 @@ from kubernetes import client, config # kubernetes api
from kubernetes.stream import stream from kubernetes.stream import stream
import lag_analysis import lag_analysis
import logging # logging import logging # logging
from os import path # path utilities from os import path, environ # path utilities
from lib.cli_parser import execution_parser from lib.cli_parser import execution_parser
import subprocess # execute bash commands import subprocess # execute bash commands
import sys # for exit of program import sys # for exit of program
...@@ -244,7 +244,7 @@ def wait_execution(execution_minutes): ...@@ -244,7 +244,7 @@ def wait_execution(execution_minutes):
return return
def run_evaluation(exp_id, uc_id, dim_value, instances, execution_minutes): def run_evaluation(exp_id, uc_id, dim_value, instances, execution_minutes, prometheus_base_url=None):
""" """
Runs the evaluation function Runs the evaluation function
:param string exp_id: ID of the experiment. :param string exp_id: ID of the experiment.
...@@ -254,7 +254,12 @@ def run_evaluation(exp_id, uc_id, dim_value, instances, execution_minutes): ...@@ -254,7 +254,12 @@ def run_evaluation(exp_id, uc_id, dim_value, instances, execution_minutes):
:param int execution_minutes: How long the use case where executed. :param int execution_minutes: How long the use case where executed.
""" """
print('Run evaluation function') print('Run evaluation function')
if prometheus_base_url is None and environ.get('PROMETHEUS_BASE_URL') is None:
lag_analysis.main(exp_id, f'uc{uc_id}', dim_value, instances, execution_minutes) lag_analysis.main(exp_id, f'uc{uc_id}', dim_value, instances, execution_minutes)
elif prometheus_base_url is not None:
lag_analysis.main(exp_id, f'uc{uc_id}', dim_value, instances, execution_minutes, prometheus_base_url)
else:
lag_analysis.main(exp_id, f'uc{uc_id}', dim_value, instances, execution_minutes, environ.get('PROMETHEUS_BASE_URL'))
return return
...@@ -449,7 +454,7 @@ def reset_cluster(wg, app_svc, app_svc_monitor, app_jmx, app_deploy, topics): ...@@ -449,7 +454,7 @@ def reset_cluster(wg, app_svc, app_svc_monitor, app_jmx, app_deploy, topics):
stop_lag_exporter() stop_lag_exporter()
def main(exp_id, uc_id, dim_value, instances, partitions, cpu_limit, memory_limit, commit_interval_ms, execution_minutes, reset, reset_only): def main(exp_id, uc_id, dim_value, instances, partitions, cpu_limit, memory_limit, commit_interval_ms, execution_minutes, prometheus_base_url=None, reset=False, reset_only=False):
""" """
Main method to execute one time the benchmark for a given use case. Main method to execute one time the benchmark for a given use case.
Start workload generator/application -> execute -> analyse -> stop all Start workload generator/application -> execute -> analyse -> stop all
...@@ -514,7 +519,7 @@ def main(exp_id, uc_id, dim_value, instances, partitions, cpu_limit, memory_limi ...@@ -514,7 +519,7 @@ def main(exp_id, uc_id, dim_value, instances, partitions, cpu_limit, memory_limi
wait_execution(execution_minutes) wait_execution(execution_minutes)
print('---------------------') print('---------------------')
run_evaluation(exp_id, uc_id, dim_value, instances, execution_minutes) run_evaluation(exp_id, uc_id, dim_value, instances, execution_minutes, prometheus_base_url)
print('---------------------') print('---------------------')
# Reset cluster regular, therefore abort exit not needed anymore # Reset cluster regular, therefore abort exit not needed anymore
...@@ -528,5 +533,5 @@ if __name__ == '__main__': ...@@ -528,5 +533,5 @@ if __name__ == '__main__':
print('---------------------') print('---------------------')
main(args.exp_id, args.uc, args.load, args.instances, main(args.exp_id, args.uc, args.load, args.instances,
args.partitions, args.cpu_limit, args.memory_limit, args.partitions, args.cpu_limit, args.memory_limit,
args.commit_ms, args.duration, args.reset, args.commit_ms, args.duration, args.prometheus, args.reset,
args.reset_only) args.reset_only)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment