Skip to content

Commit

Permalink
Show tests with max RSS (#8888)
Browse files Browse the repository at this point in the history
  • Loading branch information
maximyurchuk authored Sep 9, 2024
1 parent b440d31 commit ba80e77
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 2 deletions.
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")

0 comments on commit ba80e77

Please sign in to comment.