print benchmarks JSON results to build job log

pull/8666/head
Jan Tattermusch 4 years ago
parent 0b8d13a1d4
commit b4a06a193b
  1. 37
      benchmarks/util/result_parser.py
  2. 17
      kokoro/linux/benchmark/run.sh

@ -1,5 +1,6 @@
# This import depends on the automake rule protoc_middleman, please make sure # This import depends on the automake rule protoc_middleman, please make sure
# protoc_middleman has been built before run this file. # protoc_middleman has been built before run this file.
import argparse
import json import json
import re import re
import os.path import os.path
@ -298,3 +299,39 @@ def get_result_from_file(cpp_file="",
__parse_php_result(php_c_file, "php") __parse_php_result(php_c_file, "php")
return __results 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))

@ -89,15 +89,16 @@ echo "benchmarking js..."
# TODO(jtattermusch): add php-c-benchmark. Currently its build is broken. # TODO(jtattermusch): add php-c-benchmark. Currently its build is broken.
# upload results to bq # persist raw the results in the build job log (for better debuggability)
# TODO(jtattermusch): the upload to bq is currently broken. 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 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" -cpp="../tmp/cpp_result.json" -java="../tmp/java_result.json" -python="../tmp/python_result.json" -node="../tmp/node_result.json"
popd 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

Loading…
Cancel
Save