ci_benchmark_select.py 744 B

12345678910111213141516171819202122
  1. #!/usr/bin/python3
  2. import json
  3. from select import select
  4. import sys
  5. import os
  6. import shutil
  7. with open('performance_data.json', 'r') as perf_json_file:
  8. perf_json_data: list = json.load(perf_json_file)
  9. perf_data_with_index = []
  10. for i in range(perf_json_data.__len__()):
  11. perf_data_with_index.append({'index': i+1, 'value': perf_json_data[i]})
  12. perf_data_with_index_sorted = sorted(
  13. perf_data_with_index, key=lambda e: e['value'])
  14. selected = perf_data_with_index_sorted[int(perf_json_data.__len__()/2)]
  15. print('=============================================')
  16. print('selected: ', selected)
  17. shutil.copy('benchmark_result_' +
  18. str(selected['index']) + '.json', 'benchmark_result.json')