Split perf test into multiple checks

This commit is contained in:
alesapin 2021-12-13 11:56:54 +03:00
parent eb51d9550d
commit cf281b10dc
3 changed files with 26 additions and 4 deletions

View File

@ -73,7 +73,7 @@ jobs:
docker kill $(docker ps -q) ||:
docker rm -f $(docker ps -a -q) ||:
sudo rm -fr $TEMP_PATH
PerformanceComparison:
PerformanceComparison1:
needs: [BuilderPerformance]
runs-on: [self-hosted, perf-tester]
steps:
@ -89,8 +89,8 @@ jobs:
REPORTS_PATH: ${{runner.temp}}/reports_dir
CHECK_NAME: 'Performance Comparison (actions)'
REPO_COPY: ${{runner.temp}}/performance_comparison/ClickHouse
RAMDRIVE_PATH: ${{runner.temp}}/performance_comparison/ramdrive
RAMDRIVE_SIZE: '30G'
RUN_BY_HASH_NUM: 1
RUN_BY_HASH_TOTAL: 3
run: |
sudo rm -fr $TEMP_PATH
mkdir -p $TEMP_PATH

View File

@ -207,6 +207,22 @@ function run_tests
test_files=$(ls "$test_prefix"/*.xml)
fi
# We split perf tests into multiple checks to make them faster
if [ -v CHPC_TEST_RUN_BY_HASH_TOTAL ]; then
# filter tests array in bash https://stackoverflow.com/a/40375567
for index in "${!test_files[@]}"; do
# sorry for this, just calculating hash(test_name) % total_tests_group == my_test_group_num
test_hash_result=$(echo test_files[$index] | perl -ne 'use Digest::MD5 qw(md5); print unpack('Q', md5($_)) % $ENV{CHPC_TEST_RUN_BY_HASH_TOTAL} == $ENV{CHPC_TEST_RUN_BY_HASH_NUM};')
# BTW, for some reason when hash(test_name) % total_tests_group != my_test_group_num perl outputs nothing, not zero
if [ "$test_hash_result" != "1" ]; then
# deleting element from array
unset -v 'test_files[$index]'
fi
done
# to have sequential indexes...
test_files=("${test_files[@]}")
fi
# For PRs w/o changes in test definitons, test only a subset of queries,
# and run them less times. If the corresponding environment variables are
# already set, keep those values.

View File

@ -45,7 +45,8 @@ if __name__ == "__main__":
temp_path = os.getenv("TEMP_PATH", os.path.abspath("."))
repo_path = os.getenv("REPO_COPY", os.path.abspath("../../"))
ramdrive_path = os.getenv("RAMDRIVE_PATH", os.path.join(temp_path, "ramdrive"))
ramdrive_size = os.getenv("RAMDRIVE_SIZE", '30G')
# currently unused, doesn't make tests more stable
ramdrive_size = os.getenv("RAMDRIVE_SIZE", '0G')
reports_path = os.getenv("REPORTS_PATH", "./reports")
check_name = sys.argv[1]
@ -73,6 +74,11 @@ if __name__ == "__main__":
docker_env += ' -e CHPC_ADD_REPORT_LINKS="<a href={}>Job (actions)</a> <a href={}>Tested commit</a>"'.format(
task_url, pr_link)
if 'RUN_BY_HASH_TOTAL' in os.environ:
run_by_hash_total = int(os.getenv('RUN_BY_HASH_TOTAL'))
run_by_hash_num = int(os.getenv('RUN_BY_HASH_NUM'))
docker_env += f' -e CHPC_TEST_RUN_BY_HASH_TOTAL={run_by_hash_total} -e CHPC_TEST_RUN_BY_HASH_NUM={run_by_hash_num}'
docker_image = get_image_with_version(reports_path, IMAGE_NAME)
#with RamDrive(ramdrive_path, ramdrive_size):