MCPcopy
hub / github.com/redis/redis-py / _run_async_benchmark

Function _run_async_benchmark

benchmarks/otel_benchmark.py:1244–1270  ·  view source on GitHub ↗

Run async benchmark iterations.

(args: argparse.Namespace, config: LoadGeneratorConfig, description: str)

Source from the content-addressed store, hash-verified

1242
1243
1244async def _run_async_benchmark(args: argparse.Namespace, config: LoadGeneratorConfig, description: str) -> int:
1245 """Run async benchmark iterations."""
1246 results: List[BenchmarkResult] = []
1247 for i in range(args.iterations):
1248 print(f"\n--- Iteration {i + 1}/{args.iterations} ---")
1249
1250 if args.scenario == "baseline":
1251 result = await run_baseline_scenario_async(tag=args.baseline_tag, config=config)
1252 if result is None:
1253 print("ERROR: Baseline benchmark failed")
1254 return 1
1255 else:
1256 result = await run_iteration_async(args.scenario, config, description)
1257
1258 results.append(result)
1259 print(f" Ops/sec: {result.operations_per_second:,.0f}")
1260
1261 # Average results across all iterations
1262 final_result = average_results(results)
1263
1264 # Output results
1265 if args.json:
1266 print(json.dumps(asdict(final_result), indent=2))
1267 else:
1268 print_result(final_result, iterations=args.iterations)
1269
1270 return 0
1271
1272
1273if __name__ == "__main__":

Callers 1

mainFunction · 0.85

Calls 5

run_iteration_asyncFunction · 0.85
average_resultsFunction · 0.85
print_resultFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected