def run_sequential_benchmark(benchmark: Benchmark): ### # Deploy cloudstash ### log("----- Create Infrastructure") # deploy cloudstash using serverless, get the api gateway url of the deployment gateway_url, deployed = deploy_cloudstash(benchmark.stage) # set gateway_url in benchmark object benchmark.gateway_url = gateway_url # make sure everything is ready before starting benchmark log(f"Waiting {config.ORCHESTRATION_DELAY} seconds before starting benchmark" ) sleep(config.ORCHESTRATION_DELAY) ### # Run the benchmark ### log("----- Run Benchmark") # run benchmark if deployed: benchmark_ran, benchmark_data = run_benchmark(benchmark) # save when the experiment finished running benchmark.log_experiment_stop_time() ### # Parse benchmark output ### log("----- Parse Benchmark results") if benchmark_ran: benchmark_output_file = f"{config.BENCHMARK_OUTPUT_PATH}/{benchmark.stage}-{benchmark.benchmark}-{benchmark.number_of_artefacts}.csv" wrote_file = write_benchmark_results_csv_file(benchmark, benchmark_output_file, benchmark_data) ### # Teardown cloudstash instance ### log("----- Remove Benchmark Infrastructure") # remove the cloudstash deployment removed = remove_deployment(benchmark.stage) ### # End Benchmark orchestration ### log("-----") log(f"Benchmark orchestration finished.") log(f"Benchmark running time: {benchmark.running_time}")
def run_load_test(benchmark: Benchmark): ### # Deploy cloudstash ### shouldDeploy = True log("----- Create Infrastructure") # deploy cloudstash using serverless, get the api gateway url of the deployment if shouldDeploy: gateway_url, deployed = deploy_cloudstash(benchmark.stage) # set gateway_url in benchmark object benchmark.gateway_url = gateway_url else: benchmark.gateway_url = "https://2sxivumsse.execute-api.eu-west-1.amazonaws.com/d1bd1f4a" deployed = True # make sure everything is ready before starting benchmark if shouldDeploy: log(f"Waiting {config.ORCHESTRATION_DELAY} seconds before starting benchmark" ) sleep(config.ORCHESTRATION_DELAY) ### # Run the benchmark ### log("----- Run Benchmark") # run benchmark if deployed: benchmark_ran, benchmark_data = run_benchmark(benchmark) # save when the experiment finished running benchmark.log_experiment_stop_time() ### # Parse benchmark output ### log("----- Parse Benchmark results") if benchmark_ran: # filename for benchmark results .csv benchmark_output_file = f"{config.BENCHMARK_OUTPUT_PATH}/{benchmark.stage}-{benchmark.benchmark}-{benchmark.number_of_artefacts}.csv" # function to write benchmark results .csv wrote_file = write_benchmark_results_csv_file(benchmark, benchmark_output_file, benchmark_data) ### # Teardown cloudstash instance ### log("----- Remove Benchmark Infrastructure") if shouldDeploy: # remove the cloudstash deployment removed = remove_deployment(benchmark.stage) ### # End Benchmark orchestration ### log("-----") log(f"Benchmark orchestration finished.") log(f"Benchmark running time: {benchmark.running_time}")