Skip to content

Commit ac9c554

Browse files
author
t00939662
committed
[Feat]Add import checking to trace replay and fix the issue of unclosed network resources
1 parent b53b23a commit ac9c554

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

benchmarks/trace_replay.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -540,14 +540,16 @@ async def send_group(r=reqs, d=delay):
540540
flat_requests.extend(reqs)
541541

542542
group_results = await asyncio.gather(*tasks)
543+
544+
if pbar is not None:
545+
pbar.close()
546+
await session.close()
547+
543548
outputs = []
544549
for res in group_results:
545550
if isinstance(res, list):
546551
outputs.extend(res)
547552

548-
if pbar is not None:
549-
pbar.close()
550-
551553
benchmark_duration = time.perf_counter() - start_time
552554
metrics, actual_output_lens = calculate_metrics(
553555
input_requests=flat_requests,
@@ -678,6 +680,14 @@ def main(args: argparse.Namespace):
678680

679681

680682
if __name__ == "__main__":
683+
# Check openpyxl for Excel export
684+
try:
685+
import openpyxl
686+
except ImportError:
687+
print("\nMissing package: openpyxl")
688+
print("Please install openpyxl via pip install.\n")
689+
sys.exit(1)
690+
681691
parser = create_argument_trace()
682692
args = parser.parse_args()
683693
main(args)

0 commit comments

Comments
 (0)