-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core: auto generated markdown tables
- Loading branch information
1 parent
914252c
commit 43597c0
Showing
6 changed files
with
92 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,7 @@ | ||
name: Run App Integration Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: [assigned, opened, synchronize, reopened] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
run: | ||
|
@@ -33,6 +29,16 @@ jobs: | |
FAL_TARGET_NODE: ${{ secrets.FAL_TARGET_NODE }} | ||
run: | | ||
python -m benchmarks /tmp \ | ||
--session-id="${{ github.run_id }}" \ | ||
--session-id=latest \ | ||
--target-node=$FAL_TARGET_NODE | ||
- name: Regenerate tables | ||
run: python benchmarks/regenerate_tables.py /tmp/latest.json | ||
|
||
- name: Commit and push changes | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: "perf: update benchmarks" | ||
commit_options: "--no-verify" | ||
commit_user_name: "Fal Bot" | ||
commit_user_email: "[email protected]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import json | ||
import statistics | ||
from argparse import ArgumentParser | ||
from pathlib import Path | ||
|
||
README_PATH = Path(__file__).parent.parent / "README.md" | ||
TABLE_HEADER = "| | mean (s) | median (s) | min (s) | max (s) |\n" | ||
TABLE_DIVIDER = "|------------------|----------|------------|---------|---------|\n" | ||
TABLE_ROW_FORMAT = ( | ||
"| {name:16} | {mean:7.3f}s | {median:9.3f}s | {min:6.3f}s | {max:6.3f}s |\n" | ||
) | ||
START_MARKER = "<!-- START TABLE -->\n" | ||
END_MARKER = "<!-- END TABLE -->\n" | ||
|
||
|
||
def main(): | ||
parser = ArgumentParser() | ||
parser.add_argument("results_file", type=Path) | ||
parser.add_argument("--document-path", type=Path, default=README_PATH) | ||
|
||
options = parser.parse_args() | ||
with open(options.results_file) as f: | ||
results = json.load(f) | ||
|
||
with open(options.document_path) as f: | ||
lines = f.readlines() | ||
|
||
table_lines = [TABLE_HEADER, TABLE_DIVIDER] | ||
for timing in results["timings"]: | ||
benchmark_name = timing["name"] | ||
benchmark_timings = timing["timings"] | ||
table_lines.append( | ||
TABLE_ROW_FORMAT.format( | ||
name=benchmark_name, | ||
mean=statistics.mean(benchmark_timings), | ||
median=statistics.median(benchmark_timings), | ||
min=min(benchmark_timings), | ||
max=max(benchmark_timings), | ||
) | ||
) | ||
|
||
start_index = lines.index(START_MARKER) + 1 | ||
end_index = lines.index(END_MARKER) | ||
lines[start_index:end_index] = table_lines | ||
|
||
with open(options.document_path, "w") as f: | ||
f.writelines(lines) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |