The main function. This will run the comparison function to compare two benchmarking runs.
()
| 330 | |
| 331 | |
| 332 | def main(): |
| 333 | """ |
| 334 | The main function. This will run the comparison function to compare two benchmarking runs. |
| 335 | """ |
| 336 | parser = argparse.ArgumentParser("Summarize and compare benchmarking runs.") |
| 337 | |
| 338 | parser.add_argument( |
| 339 | "-o", |
| 340 | "--output-dir", |
| 341 | type=str, |
| 342 | required=True, |
| 343 | help="The output directory where you want to store the result summary as a CSV file.", |
| 344 | ) |
| 345 | |
| 346 | parser.add_argument( |
| 347 | "-b", |
| 348 | "--baseline-json", |
| 349 | type=str, |
| 350 | required=True, |
| 351 | help="Path where the benchmark.py styled JSON of the baseline run is stored.", |
| 352 | ) |
| 353 | parser.add_argument( |
| 354 | "-bn", |
| 355 | "--baseline-name", |
| 356 | type=str, |
| 357 | required=True, |
| 358 | help="The name of the column representing the baseline run in the output table.", |
| 359 | ) |
| 360 | parser.add_argument( |
| 361 | "-c", |
| 362 | "--compare-jsons", |
| 363 | action="append", |
| 364 | required=False, |
| 365 | help="Optional. List of paths where the benchmark.py styled JSON of the comparison run are stored.", |
| 366 | ) |
| 367 | parser.add_argument( |
| 368 | "-cn", |
| 369 | "--compare-names", |
| 370 | action="append", |
| 371 | required=False, |
| 372 | help="Optional. List of names of the column representing the comparison runs in the output table.", |
| 373 | ) |
| 374 | |
| 375 | args = parser.parse_args() |
| 376 | |
| 377 | if not os.path.isdir(args.output_dir): |
| 378 | raise ValueError("output-dir does not exist: %s" % args.output_dir) |
| 379 | |
| 380 | if not os.path.isfile(args.baseline_json): |
| 381 | raise ValueError("baseline-json does not exist: %s" % args.baseline_json) |
| 382 | |
| 383 | args.compare_jsons = args.compare_jsons if args.compare_jsons else [] |
| 384 | args.compare_names = args.compare_names if args.compare_names else [] |
| 385 | |
| 386 | if len(args.compare_jsons) != len(args.compare_names): |
| 387 | raise ValueError( |
| 388 | "Length mismatch between the number of given JSON paths for comparison and" |
| 389 | "their run names. %d v/s %d. Each JSON must have its corresponding run name." |
no test coverage detected