From 8b775834d6e7e5c6426b6f784406da961e1445c8 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 2 Dec 2020 10:56:41 +0100 Subject: [PATCH] add "scenarios" top level element --- tools/run_tests/performance/scenario_config_exporter.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/run_tests/performance/scenario_config_exporter.py b/tools/run_tests/performance/scenario_config_exporter.py index 33e7b17d681..23aad5c4569 100755 --- a/tools/run_tests/performance/scenario_config_exporter.py +++ b/tools/run_tests/performance/scenario_config_exporter.py @@ -15,6 +15,8 @@ # limitations under the License. # Helper script to extract JSON scenario definitions from scenario_config.py +# Useful to construct "ScenariosJSON" configuration accepted by the OSS benchmarks framework +# See https://github.com/grpc/test-infra/blob/master/config/samples/cxx_example_loadtest.yaml import json import re @@ -47,7 +49,8 @@ def dump_to_json_files(json_scenarios, filename_prefix='scenario_dump_'): filename = "%s%s.json" % (filename_prefix, scenario['name']) print('Writing file %s' % filename, file=sys.stderr) with open(filename, 'w') as outfile: - json.dump(scenario, outfile, indent=2) + # the dump file should have {"scenarios" : []} as the top level element + json.dump({'scenarios': [scenario]}, outfile, indent=2) if __name__ == "__main__":