Skip to content

Commit b1aa39d

Browse files
committed
review fixes
1 parent bdafb97 commit b1aa39d

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

.github/actions/test_ya/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ runs:
349349
set -ex
350350
RC=`cat exit_code`
351351

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

354354
# convert to chromium trace
355355
# seems analyze-make don't have simple "output" parameter, so change cwd

.github/scripts/tests/report_analyzer.py

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,30 @@
44
The tool used to analyze file created by "ya make ... --build-results-report <file>"
55
"""
66

7+
import argparse
78
import sys
89
import json
910

1011
if __name__ == "__main__":
11-
report_path = sys.argv[1]
12-
summary_path = sys.argv[2]
12+
parser = argparse.ArgumentParser()
13+
parser.add_argument(
14+
"--report_file",
15+
help="path to file received via 'ya make ... --build-results-report <file>'",
16+
type=argparse.FileType("r"),
17+
required=True
18+
)
19+
parser.add_argument(
20+
"--summary_file",
21+
help="output file for summary",
22+
type=argparse.FileType("w"),
23+
default="-"
24+
)
25+
args = parser.parse_args()
1326

14-
with open(report_path) as f:
15-
obj = json.loads(f.read())
27+
report_file = args.report_file
28+
summary_file = args.summary_file
29+
30+
obj = json.load(report_file)
1631

1732
all = []
1833

@@ -24,8 +39,7 @@
2439
all.append((rss_consumtion, path))
2540

2641
all.sort()
27-
with open (summary_path, "w") as f:
28-
f.write("RSS usage by tests, sorted\n\n")
29-
for rss, path in all:
30-
f.write("{} {:.2f} GiB \n".format(path, rss))
31-
f.write("\n")
42+
summary_file.write("RSS usage by tests, sorted\n\n")
43+
for rss, path in all:
44+
summary_file.write("{} {:.2f} GiB\n".format(path, rss))
45+
summary_file.write("\n")

0 commit comments

Comments
 (0)