Skip to content

Commit a2640aa

Browse files
committed
amend to comments
1 parent d264d07 commit a2640aa

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

devops/actions/run-tests/benchmark/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ runs:
171171
--regression-filter '^[a-z_]+_sycl ' \
172172
--regression-filter-type 'SYCL' \
173173
--verbose \
174-
--produce-github-summary "github_summary.md" \
174+
--produce-github-summary \
175175
${{ inputs.dry_run == 'true' && '--dry-run' || '' }} \
176176

177177
echo "-----"

devops/scripts/benchmarks/compare.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -356,9 +356,8 @@ def to_hist(
356356
)
357357
parser_avg.add_argument(
358358
"--produce-github-summary",
359-
type=str,
360-
help="Create a github CI summary file using the provided filename",
361-
default="",
359+
action="store_true",
360+
help=f"Create a summary file '{options.github_summary_filename}' for Github workflow summaries.",
362361
)
363362

364363
args = parser.parse_args()
@@ -377,18 +376,14 @@ def to_hist(
377376
args.avg_type, args.name, args.compare_file, args.results_dir, args.cutoff
378377
)
379378

380-
# Initialize github summary variables:
379+
# Initialize Github summary variables:
381380
if args.produce_github_summary:
382381
gh_summary = []
383382

384383
filter_type_capitalized = (
385384
args.regression_filter_type[0].upper() + args.regression_filter_type[1:]
386385
)
387386

388-
def write_summary_to_file(summary: list[str]):
389-
with open(args.produce_github_summary, "w") as f:
390-
f.write("\n".join(summary))
391-
392387
# Not all regressions are of concern: if a filter is provided, filter
393388
# regressions using filter
394389
regressions_ignored = []
@@ -402,7 +397,7 @@ def write_summary_to_file(summary: list[str]):
402397
regressions_ignored.append(test)
403398

404399
def print_regression(entry: dict, is_warning: bool = False):
405-
"""Print an entry outputted from Compare.to_hist[github_summary.md")
400+
"""Print an entry outputted from Compare.to_hist()
406401
407402
Args:
408403
entry (dict): The entry to print
@@ -421,6 +416,12 @@ def print_regression(entry: dict, is_warning: bool = False):
421416
)
422417
gh_summary.append(f"- Run result: {entry['value']}")
423418
gh_summary.append(
419+
# Since we are dealing with floats, our deltas have a lot
420+
# of decimal places. For easier readability, we round our
421+
# deltas and format our Github summary output as:
422+
#
423+
# Delta: <rounded number>% (<full number>)
424+
#
424425
f"- Delta: {round(entry['delta']*100, 2)}% ({entry['delta']})"
425426
)
426427
gh_summary.append("")
@@ -472,13 +473,15 @@ def print_regression(entry: dict, is_warning: bool = False):
472473

473474
if not args.dry_run:
474475
if args.produce_github_summary:
475-
write_summary_to_file(gh_summary)
476-
exit(1) # Exit 1 to trigger github test failure
476+
with open(options.github_summary_filename, "w") as f:
477+
f.write("\n".join(summary))
478+
exit(1) # Exit 1 to trigger Github test failure
477479

478480
log.info("No unexpected regressions found!")
479481
if args.produce_github_summary:
480482
gh_summary.append("No unexpected regressions found!")
481-
write_summary_to_file(gh_summary)
483+
with open(options.github_summary_filename, "w") as f:
484+
f.write("\n".join(summary))
482485

483486
else:
484487
log.error("Unsupported operation: exiting.")

devops/scripts/benchmarks/options.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ class Options:
9292
# CI scripts vs SYCl build source.
9393
github_repo_override: str = None
9494
git_commit_override: str = None
95+
# Filename used to store Github summary files:
96+
github_summary_filename: str = "github_summary.md"
9597
# Archiving settings
9698
# Archived runs are stored separately from the main dataset but are still accessible
9799
# via the HTML UI when "Include archived runs" is enabled.

0 commit comments

Comments
 (0)