diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index aba9e61b6c3..2dc18ba88e9 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -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
diff --git a/docker/test/performance-comparison/compare.sh b/docker/test/performance-comparison/compare.sh
index 532ae68025a..2fcb1a25bc6 100755
--- a/docker/test/performance-comparison/compare.sh
+++ b/docker/test/performance-comparison/compare.sh
@@ -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.
diff --git a/tests/ci/performance_comparison_check.py b/tests/ci/performance_comparison_check.py
index ee27d9f15dc..ee0918289c2 100644
--- a/tests/ci/performance_comparison_check.py
+++ b/tests/ci/performance_comparison_check.py
@@ -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="Job (actions) Tested commit"'.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):