Skip to content

Commit

Permalink
Merge pull request #8666 from jtattermusch/protobuf_fix_result_parser
Browse files Browse the repository at this point in the history
OSS benchmarks: print benchmarks JSON results to build job log
  • Loading branch information
jtattermusch authored Jun 3, 2021
2 parents 7a374d4 + b4a06a1 commit 439e6cf
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 8 deletions.
37 changes: 37 additions & 0 deletions benchmarks/util/result_parser.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This import depends on the automake rule protoc_middleman, please make sure
# protoc_middleman has been built before run this file.
import argparse
import json
import re
import os.path
Expand Down Expand Up @@ -298,3 +299,39 @@ def get_result_from_file(cpp_file="",
__parse_php_result(php_c_file, "php")

return __results

if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("-cpp", "--cpp_input_file",
help="The CPP benchmark result file's name",
default="")
parser.add_argument("-java", "--java_input_file",
help="The Java benchmark result file's name",
default="")
parser.add_argument("-python", "--python_input_file",
help="The Python benchmark result file's name",
default="")
parser.add_argument("-go", "--go_input_file",
help="The golang benchmark result file's name",
default="")
parser.add_argument("-node", "--node_input_file",
help="The node.js benchmark result file's name",
default="")
parser.add_argument("-php", "--php_input_file",
help="The pure php benchmark result file's name",
default="")
parser.add_argument("-php_c", "--php_c_input_file",
help="The php with c ext benchmark result file's name",
default="")
args = parser.parse_args()

results = get_result_from_file(
cpp_file=args.cpp_input_file,
java_file=args.java_input_file,
python_file=args.python_input_file,
go_file=args.go_input_file,
node_file=args.node_input_file,
php_file=args.php_input_file,
php_c_file=args.php_c_input_file,
)
print(json.dumps(results, indent=2))
17 changes: 9 additions & 8 deletions kokoro/linux/benchmark/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,16 @@ echo "benchmarking js..."

# TODO(jtattermusch): add php-c-benchmark. Currently its build is broken.

# upload results to bq
# TODO(jtattermusch): the upload to bq is currently broken.
# persist raw the results in the build job log (for better debuggability)
cat tmp/cpp_result.json
cat tmp/java_result.json
cat tmp/python_result.json
cat tmp/node_result.json

# print the postprocessed results to the build job log
# TODO(jtattermusch): re-enable uploading results to bigquery (it is currently broken)
make python_add_init
env LD_LIBRARY_PATH="${repo_root}/src/.libs" python -m util.result_uploader \
env LD_LIBRARY_PATH="${repo_root}/src/.libs" python -m util.result_parser \
-cpp="../tmp/cpp_result.json" -java="../tmp/java_result.json" -python="../tmp/python_result.json" -node="../tmp/node_result.json"
popd

# also persist the results in the build job log (for better debuggability)
cat benchmarks/tmp/cpp_result.json
cat benchmarks/tmp/java_result.json
cat benchmarks/tmp/python_result.json
cat benchmarks/tmp/node_result.json

0 comments on commit 439e6cf

Please sign in to comment.