Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show tests with max RSS #8888

Merged
merged 5 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/actions/test_ya/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -340,15 +340,17 @@ runs:
echo $CURRENT_MESSAGE | GITHUB_TOKEN="${{ github.token }}" .github/scripts/tests/comment-pr.py

CURRENT_JUNIT_XML_PATH=$CURRENT_PUBLIC_DIR/junit.xml
CURRENT_REPORT=$CURRENT_PUBLIC_DIR/report.txt
CURRENT_REPORT=$CURRENT_PUBLIC_DIR/report.json
set +ex
(./ya make $YA_MAKE_TARGET "${params[@]}" \
$RERUN_FAILED_OPT --log-file "$PUBLIC_DIR/ya_log.log" \
--evlog-file "$CURRENT_PUBLIC_DIR/ya_evlog.jsonl" \
--junit "$CURRENT_JUNIT_XML_PATH" --build-results-report $CURRENT_REPORT --output "$YA_MAKE_OUT_DIR"; echo $? > exit_code) |& cat >> $YA_MAKE_OUTPUT
--junit "$CURRENT_JUNIT_XML_PATH" --build-results-report "$CURRENT_REPORT" --output "$YA_MAKE_OUT_DIR"; echo $? > exit_code) |& cat >> $YA_MAKE_OUTPUT
set -ex
RC=`cat exit_code`

.github/scripts/tests/report_analyzer.py --report_file "$CURRENT_REPORT" --summary_file $CURRENT_PUBLIC_DIR/summary_report.txt || true

# convert to chromium trace
# seems analyze-make don't have simple "output" parameter, so change cwd
ya_dir=$(pwd)
Expand Down
45 changes: 45 additions & 0 deletions .github/scripts/tests/report_analyzer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env python3

"""
The tool used to analyze file created by "ya make ... --build-results-report <file>"
"""

import argparse
import sys
import json

if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"--report_file",
help="path to file received via 'ya make ... --build-results-report <file>'",
type=argparse.FileType("r"),
required=True
)
parser.add_argument(
"--summary_file",
help="output file for summary",
type=argparse.FileType("w"),
default="-"
)
args = parser.parse_args()

report_file = args.report_file
summary_file = args.summary_file

obj = json.load(report_file)

all = []

for result in obj["results"]:
type_ = result["type"]
if type_ == "test" and result.get("chunk"):
rss_consumtion = result["metrics"].get("suite_max_proc_tree_memory_consumption_kb", 0) / 1024 / 1024
path = result["path"] + " " + result.get("subtest_name", "")
all.append((rss_consumtion, path))

all.sort()
summary_file.write("RSS usage by tests, sorted\n\n")
for rss, path in all:
summary_file.write("{} {:.2f} GiB\n".format(path, rss))
summary_file.write("\n")