From a5cafe25f9510806c2b41d9b62d1bab8005f8b77 Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger Date: Fri, 1 Apr 2022 16:37:34 +0200 Subject: [PATCH 01/36] Allow to run only a subset of tests but on all random seeds --- azure-pipelines.yml | 15 +++++++++++++++ build_tools/azure/posix-docker.yml | 2 ++ build_tools/azure/posix.yml | 8 ++++++-- build_tools/azure/test_script.sh | 6 ++++++ build_tools/azure/windows.yml | 4 +++- 5 files changed, 32 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f5f9e1e5e2c66..f6cc8eb47ed50 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -21,10 +21,25 @@ jobs: # message is the second to last commit COMMIT_ID=$(echo $BUILD_SOURCEVERSIONMESSAGE | awk '{print $2}') message=$(git log $COMMIT_ID -1 --pretty=%B) + message=$(echo $message) else message=$BUILD_SOURCEVERSIONMESSAGE fi echo "##vso[task.setvariable variable=message;isOutput=true]$message" + + # Check if run only specific tests but on all random seeds + # commit message must take the form + # [all random seeds] + # <test_name_1> + # <test_name_2> + # ... + if [[ "$message" =~ \[all\ random\ seeds\] ]]; then + message=$(echo $message | sed -n -e 's/^.*all\ random\ seeds\] //p') + selected="${message// / or }" + else + selected="" + fi + echo "##vso[task.setvariable variable=selected;isOutput=true]$selected" name: commit displayName: Get source version message diff --git a/build_tools/azure/posix-docker.yml b/build_tools/azure/posix-docker.yml index 57ea3c84065c8..61f50ee3410f0 100644 --- a/build_tools/azure/posix-docker.yml +++ b/build_tools/azure/posix-docker.yml @@ -32,6 +32,7 @@ jobs: COVERAGE: 'false' TEST_DOCSTRINGS: 'false' BLAS: 'openblas' + SELECTED_TESTS: $[ dependencies.git_commit.outputs['commit.selected'] ] # Set in azure-pipelines.yml DISTRIB: '' DOCKER_CONTAINER: '' @@ -84,6 +85,7 @@ jobs: -e OPENBLAS_NUM_THREADS=$OPENBLAS_NUM_THREADS -e SKLEARN_SKIP_NETWORK_TESTS=$SKLEARN_SKIP_NETWORK_TESTS -e BLAS=$BLAS + -e SELECTED_TESTS=$SELECTED_TESTS -e CPU_COUNT=$CPU_COUNT -e CCACHE_DIR=/ccache -e CCACHE_COMPRESS=$CCACHE_COMPRESS diff --git a/build_tools/azure/posix.yml b/build_tools/azure/posix.yml index 9de584adcdf49..e4e7f0775f899 100644 --- a/build_tools/azure/posix.yml +++ b/build_tools/azure/posix.yml @@ -37,6 +37,7 @@ jobs: TEST_DOCSTRINGS: 'false' CREATE_ISSUE_ON_TRACKER: 'false' SHOW_SHORT_SUMMARY: 'false' + SELECTED_TESTS: $[ dependencies.git_commit.outputs['commit.selected'] ] strategy: matrix: ${{ insert }}: ${{ parameters.matrix }} @@ -65,10 +66,12 @@ jobs: - script: | build_tools/azure/test_docs.sh displayName: 'Test Docs' + condition: eq(variables['SELECTED_TESTS'], '') - script: | build_tools/azure/test_pytest_soft_dependency.sh displayName: 'Test Soft Dependency' - condition: eq(variables['CHECK_PYTEST_SOFT_DEPENDENCY'], 'true') + condition: and(eq(variables['CHECK_PYTEST_SOFT_DEPENDENCY'], 'true'), + eq(variables['SELECTED_TESTS'], '')) - task: PublishTestResults@2 inputs: testResultsFiles: '$(TEST_DIR)/$(JUNITXML)' @@ -106,7 +109,8 @@ jobs: eq(variables['Build.Reason'], 'Schedule')) - script: | build_tools/azure/upload_codecov.sh - condition: and(succeeded(), eq(variables['COVERAGE'], 'true')) + condition: and(succeeded(), eq(variables['COVERAGE'], 'true'), + eq(variables['SELECTED_TESTS'], '')) displayName: 'Upload To Codecov' env: CODECOV_TOKEN: $(CODECOV_TOKEN) diff --git a/build_tools/azure/test_script.sh b/build_tools/azure/test_script.sh index 998a1e4628086..f9fbed99d14cc 100755 --- a/build_tools/azure/test_script.sh +++ b/build_tools/azure/test_script.sh @@ -59,6 +59,12 @@ if [[ "$SHOW_SHORT_SUMMARY" == "true" ]]; then TEST_CMD="$TEST_CMD -ra" fi +if [[ "$SELECTED_TESTS" != "" ]]; then + TEST_CMD="$TEST_CMD -k '$SELECTED_TESTS'" + # Override to make selected tests run on all random seeds + export SKLEARN_TESTS_GLOBAL_RANDOM_SEED="all" +fi + set -x eval "$TEST_CMD --pyargs sklearn" set +x diff --git a/build_tools/azure/windows.yml b/build_tools/azure/windows.yml index 7402f1739fc3c..ad7e7fed0e9f2 100644 --- a/build_tools/azure/windows.yml +++ b/build_tools/azure/windows.yml @@ -21,6 +21,7 @@ jobs: TEST_DIR: '$(Agent.WorkFolder)/tmp_folder' SHOW_SHORT_SUMMARY: 'false' CPU_COUNT: '2' + SELECTED_TESTS: $[ dependencies.git_commit.outputs['commit.selected'] ] strategy: matrix: ${{ insert }}: ${{ parameters.matrix }} @@ -41,7 +42,8 @@ jobs: - bash: ./build_tools/azure/test_script.sh displayName: 'Test Library' - bash: ./build_tools/azure/upload_codecov.sh - condition: and(succeeded(), eq(variables['COVERAGE'], 'true')) + condition: and(succeeded(), eq(variables['COVERAGE'], 'true'), + eq(variables['SELECTED_TESTS'], '')) displayName: 'Upload To Codecov' env: CODECOV_TOKEN: $(CODECOV_TOKEN) From 91a0df455f56e4a686e612b0cc158db769775eb6 Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Fri, 1 Apr 2022 23:53:50 +0200 Subject: [PATCH 02/36] [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results From 041edc1e1c993781fffe74e3aea3f71661db3088 Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Tue, 5 Apr 2022 14:26:26 +0200 Subject: [PATCH 03/36] parse commit message in templates --- azure-pipelines.yml | 14 -------------- build_tools/azure/posix-docker.yml | 21 +++++++++++++++++++-- build_tools/azure/posix.yml | 19 ++++++++++++++++++- build_tools/azure/windows.yml | 19 ++++++++++++++++++- 4 files changed, 55 insertions(+), 18 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f6cc8eb47ed50..0e2767d18896f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -26,20 +26,6 @@ jobs: message=$BUILD_SOURCEVERSIONMESSAGE fi echo "##vso[task.setvariable variable=message;isOutput=true]$message" - - # Check if run only specific tests but on all random seeds - # commit message must take the form - # <title> [all random seeds] - # <test_name_1> - # <test_name_2> - # ... - if [[ "$message" =~ \[all\ random\ seeds\] ]]; then - message=$(echo $message | sed -n -e 's/^.*all\ random\ seeds\] //p') - selected="${message// / or }" - else - selected="" - fi - echo "##vso[task.setvariable variable=selected;isOutput=true]$selected" name: commit displayName: Get source version message diff --git a/build_tools/azure/posix-docker.yml b/build_tools/azure/posix-docker.yml index 61f50ee3410f0..5e86e6418d0e8 100644 --- a/build_tools/azure/posix-docker.yml +++ b/build_tools/azure/posix-docker.yml @@ -32,7 +32,6 @@ jobs: COVERAGE: 'false' TEST_DOCSTRINGS: 'false' BLAS: 'openblas' - SELECTED_TESTS: $[ dependencies.git_commit.outputs['commit.selected'] ] # Set in azure-pipelines.yml DISTRIB: '' DOCKER_CONTAINER: '' @@ -45,6 +44,24 @@ jobs: ${{ insert }}: ${{ parameters.matrix }} steps: + - bash: | + set -ex + message=$[ dependencies.git_commit.outputs['commit.message'] ] + + # Check if run only specific tests but on all random seeds + # commit message must take the form + # <title> [all random seeds] + # <test_name_1> + # <test_name_2> + # ... + if [[ "$message" =~ \[all\ random\ seeds\] ]]; then + message=$(echo $message | sed -n -e 's/^.*all\ random\ seeds\] //p') + selected="${message// / or }" + else + selected="" + fi + echo "##vso[task.setvariable variable=SELECTED_TESTS;isOutput=true]$selected" + displayName: Check selected tests for all random seeds - task: Cache@2 inputs: key: '"ccache-v1" | "$(Agent.JobName)" | "$(Build.BuildNumber)"' @@ -85,7 +102,7 @@ jobs: -e OPENBLAS_NUM_THREADS=$OPENBLAS_NUM_THREADS -e SKLEARN_SKIP_NETWORK_TESTS=$SKLEARN_SKIP_NETWORK_TESTS -e BLAS=$BLAS - -e SELECTED_TESTS=$SELECTED_TESTS + -e SELECTED_TESTS=$(SELECTED_TESTS) -e CPU_COUNT=$CPU_COUNT -e CCACHE_DIR=/ccache -e CCACHE_COMPRESS=$CCACHE_COMPRESS diff --git a/build_tools/azure/posix.yml b/build_tools/azure/posix.yml index e4e7f0775f899..38696a14391de 100644 --- a/build_tools/azure/posix.yml +++ b/build_tools/azure/posix.yml @@ -37,12 +37,29 @@ jobs: TEST_DOCSTRINGS: 'false' CREATE_ISSUE_ON_TRACKER: 'false' SHOW_SHORT_SUMMARY: 'false' - SELECTED_TESTS: $[ dependencies.git_commit.outputs['commit.selected'] ] strategy: matrix: ${{ insert }}: ${{ parameters.matrix }} steps: + - bash: | + set -ex + message=$[ dependencies.git_commit.outputs['commit.message'] ] + + # Check if run only specific tests but on all random seeds + # commit message must take the form + # <title> [all random seeds] + # <test_name_1> + # <test_name_2> + # ... + if [[ "$message" =~ \[all\ random\ seeds\] ]]; then + message=$(echo $message | sed -n -e 's/^.*all\ random\ seeds\] //p') + selected="${message// / or }" + else + selected="" + fi + echo "##vso[task.setvariable variable=SELECTED_TESTS;isOutput=true]$selected" + displayName: Check selected tests for all random seeds - bash: echo "##vso[task.prependpath]$CONDA/bin" displayName: Add conda to PATH condition: startsWith(variables['DISTRIB'], 'conda') diff --git a/build_tools/azure/windows.yml b/build_tools/azure/windows.yml index ad7e7fed0e9f2..0e337af15121e 100644 --- a/build_tools/azure/windows.yml +++ b/build_tools/azure/windows.yml @@ -21,12 +21,29 @@ jobs: TEST_DIR: '$(Agent.WorkFolder)/tmp_folder' SHOW_SHORT_SUMMARY: 'false' CPU_COUNT: '2' - SELECTED_TESTS: $[ dependencies.git_commit.outputs['commit.selected'] ] strategy: matrix: ${{ insert }}: ${{ parameters.matrix }} steps: + - bash: | + set -ex + message=$[ dependencies.git_commit.outputs['commit.message'] ] + + # Check if run only specific tests but on all random seeds + # commit message must take the form + # <title> [all random seeds] + # <test_name_1> + # <test_name_2> + # ... + if [[ "$message" =~ \[all\ random\ seeds\] ]]; then + message=$(echo $message | sed -n -e 's/^.*all\ random\ seeds\] //p') + selected="${message// / or }" + else + selected="" + fi + echo "##vso[task.setvariable variable=SELECTED_TESTS;isOutput=true]$selected" + displayName: Check selected tests for all random seeds - bash: echo "##vso[task.prependpath]$CONDA/Scripts" displayName: Add conda to PATH for 64 bit Python condition: eq(variables['PYTHON_ARCH'], '64') From 25d7b2f4f8ab52a89427239e09d09114c4fd8cb9 Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Tue, 5 Apr 2022 14:28:49 +0200 Subject: [PATCH 04/36] tst [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results From d87ef25b63a41bea64944182b8237894d0f5ce8b Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Tue, 5 Apr 2022 14:40:19 +0200 Subject: [PATCH 05/36] new tst [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results --- build_tools/azure/posix-docker.yml | 7 +++---- build_tools/azure/posix.yml | 7 +++---- build_tools/azure/windows.yml | 7 +++---- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/build_tools/azure/posix-docker.yml b/build_tools/azure/posix-docker.yml index 5e86e6418d0e8..207f6923cf4bd 100644 --- a/build_tools/azure/posix-docker.yml +++ b/build_tools/azure/posix-docker.yml @@ -32,6 +32,7 @@ jobs: COVERAGE: 'false' TEST_DOCSTRINGS: 'false' BLAS: 'openblas' + COMMIT_MESSAGE: $[ dependencies.git_commit.outputs['commit.message'] ] # Set in azure-pipelines.yml DISTRIB: '' DOCKER_CONTAINER: '' @@ -46,16 +47,14 @@ jobs: steps: - bash: | set -ex - message=$[ dependencies.git_commit.outputs['commit.message'] ] - # Check if run only specific tests but on all random seeds # commit message must take the form # <title> [all random seeds] # <test_name_1> # <test_name_2> # ... - if [[ "$message" =~ \[all\ random\ seeds\] ]]; then - message=$(echo $message | sed -n -e 's/^.*all\ random\ seeds\] //p') + if [[ "$(COMMIT_MESSAGE)" =~ \[all\ random\ seeds\] ]]; then + message=$(echo $(COMMIT_MESSAGE) | sed -n -e 's/^.*all\ random\ seeds\] //p') selected="${message// / or }" else selected="" diff --git a/build_tools/azure/posix.yml b/build_tools/azure/posix.yml index 38696a14391de..19434d7cdec1c 100644 --- a/build_tools/azure/posix.yml +++ b/build_tools/azure/posix.yml @@ -37,6 +37,7 @@ jobs: TEST_DOCSTRINGS: 'false' CREATE_ISSUE_ON_TRACKER: 'false' SHOW_SHORT_SUMMARY: 'false' + COMMIT_MESSAGE: $[ dependencies.git_commit.outputs['commit.message'] ] strategy: matrix: ${{ insert }}: ${{ parameters.matrix }} @@ -44,16 +45,14 @@ jobs: steps: - bash: | set -ex - message=$[ dependencies.git_commit.outputs['commit.message'] ] - # Check if run only specific tests but on all random seeds # commit message must take the form # <title> [all random seeds] # <test_name_1> # <test_name_2> # ... - if [[ "$message" =~ \[all\ random\ seeds\] ]]; then - message=$(echo $message | sed -n -e 's/^.*all\ random\ seeds\] //p') + if [[ "$(COMMIT_MESSAGE)" =~ \[all\ random\ seeds\] ]]; then + message=$(echo $(COMMIT_MESSAGE) | sed -n -e 's/^.*all\ random\ seeds\] //p') selected="${message// / or }" else selected="" diff --git a/build_tools/azure/windows.yml b/build_tools/azure/windows.yml index 0e337af15121e..c83a7bb9016f9 100644 --- a/build_tools/azure/windows.yml +++ b/build_tools/azure/windows.yml @@ -21,6 +21,7 @@ jobs: TEST_DIR: '$(Agent.WorkFolder)/tmp_folder' SHOW_SHORT_SUMMARY: 'false' CPU_COUNT: '2' + COMMIT_MESSAGE: $[ dependencies.git_commit.outputs['commit.message'] ] strategy: matrix: ${{ insert }}: ${{ parameters.matrix }} @@ -28,16 +29,14 @@ jobs: steps: - bash: | set -ex - message=$[ dependencies.git_commit.outputs['commit.message'] ] - # Check if run only specific tests but on all random seeds # commit message must take the form # <title> [all random seeds] # <test_name_1> # <test_name_2> # ... - if [[ "$message" =~ \[all\ random\ seeds\] ]]; then - message=$(echo $message | sed -n -e 's/^.*all\ random\ seeds\] //p') + if [[ "$(COMMIT_MESSAGE)" =~ \[all\ random\ seeds\] ]]; then + message=$(echo $(COMMIT_MESSAGE) | sed -n -e 's/^.*all\ random\ seeds\] //p') selected="${message// / or }" else selected="" From 39f74fdd1cfb6028a736ef2e12be5bf321c7fc78 Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Tue, 5 Apr 2022 15:03:04 +0200 Subject: [PATCH 06/36] new tst [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results --- build_tools/azure/posix-docker.yml | 2 +- build_tools/azure/posix.yml | 2 +- build_tools/azure/windows.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build_tools/azure/posix-docker.yml b/build_tools/azure/posix-docker.yml index 207f6923cf4bd..c3a2d16d03797 100644 --- a/build_tools/azure/posix-docker.yml +++ b/build_tools/azure/posix-docker.yml @@ -59,7 +59,7 @@ jobs: else selected="" fi - echo "##vso[task.setvariable variable=SELECTED_TESTS;isOutput=true]$selected" + echo "##vso[task.setvariable variable=SELECTED_TESTS]$selected" displayName: Check selected tests for all random seeds - task: Cache@2 inputs: diff --git a/build_tools/azure/posix.yml b/build_tools/azure/posix.yml index 19434d7cdec1c..e5f73c28cbe94 100644 --- a/build_tools/azure/posix.yml +++ b/build_tools/azure/posix.yml @@ -57,7 +57,7 @@ jobs: else selected="" fi - echo "##vso[task.setvariable variable=SELECTED_TESTS;isOutput=true]$selected" + echo "##vso[task.setvariable variable=SELECTED_TESTS]$selected" displayName: Check selected tests for all random seeds - bash: echo "##vso[task.prependpath]$CONDA/bin" displayName: Add conda to PATH diff --git a/build_tools/azure/windows.yml b/build_tools/azure/windows.yml index c83a7bb9016f9..16277ce18c314 100644 --- a/build_tools/azure/windows.yml +++ b/build_tools/azure/windows.yml @@ -41,7 +41,7 @@ jobs: else selected="" fi - echo "##vso[task.setvariable variable=SELECTED_TESTS;isOutput=true]$selected" + echo "##vso[task.setvariable variable=SELECTED_TESTS]$selected" displayName: Check selected tests for all random seeds - bash: echo "##vso[task.prependpath]$CONDA/Scripts" displayName: Add conda to PATH for 64 bit Python From c018fe61411a006cf15d5a9caac0f9487dde0117 Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Tue, 5 Apr 2022 15:10:21 +0200 Subject: [PATCH 07/36] new tst [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results --- build_tools/azure/posix-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_tools/azure/posix-docker.yml b/build_tools/azure/posix-docker.yml index c3a2d16d03797..c630286ea3c66 100644 --- a/build_tools/azure/posix-docker.yml +++ b/build_tools/azure/posix-docker.yml @@ -101,7 +101,7 @@ jobs: -e OPENBLAS_NUM_THREADS=$OPENBLAS_NUM_THREADS -e SKLEARN_SKIP_NETWORK_TESTS=$SKLEARN_SKIP_NETWORK_TESTS -e BLAS=$BLAS - -e SELECTED_TESTS=$(SELECTED_TESTS) + -e SELECTED_TESTS="$SELECTED_TESTS" -e CPU_COUNT=$CPU_COUNT -e CCACHE_DIR=/ccache -e CCACHE_COMPRESS=$CCACHE_COMPRESS From 6383fd136ce05c1d1b1fc3902cd01d1a115e7a85 Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Tue, 5 Apr 2022 15:27:21 +0200 Subject: [PATCH 08/36] debug win [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results --- build_tools/azure/test_script.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build_tools/azure/test_script.sh b/build_tools/azure/test_script.sh index f9fbed99d14cc..53741465015bb 100755 --- a/build_tools/azure/test_script.sh +++ b/build_tools/azure/test_script.sh @@ -60,6 +60,7 @@ if [[ "$SHOW_SHORT_SUMMARY" == "true" ]]; then fi if [[ "$SELECTED_TESTS" != "" ]]; then + echo $SELECTED_TESTS TEST_CMD="$TEST_CMD -k '$SELECTED_TESTS'" # Override to make selected tests run on all random seeds export SKLEARN_TESTS_GLOBAL_RANDOM_SEED="all" From 59199a4677d005ae49b2f8e892574e47d73ea1b6 Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Tue, 5 Apr 2022 16:55:06 +0200 Subject: [PATCH 09/36] tst [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results --- build_tools/azure/posix-docker.yml | 4 ++-- build_tools/azure/posix.yml | 4 ++-- build_tools/azure/windows.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build_tools/azure/posix-docker.yml b/build_tools/azure/posix-docker.yml index c630286ea3c66..8f5d4b67b1a5e 100644 --- a/build_tools/azure/posix-docker.yml +++ b/build_tools/azure/posix-docker.yml @@ -53,8 +53,8 @@ jobs: # <test_name_1> # <test_name_2> # ... - if [[ "$(COMMIT_MESSAGE)" =~ \[all\ random\ seeds\] ]]; then - message=$(echo $(COMMIT_MESSAGE) | sed -n -e 's/^.*all\ random\ seeds\] //p') + if [[ "$COMMIT_MESSAGE" =~ \[all\ random\ seeds\] ]]; then + message=$(echo $COMMIT_MESSAGE | sed -n -e 's/^.*all\ random\ seeds\] //p') selected="${message// / or }" else selected="" diff --git a/build_tools/azure/posix.yml b/build_tools/azure/posix.yml index e5f73c28cbe94..99ebf90e49adf 100644 --- a/build_tools/azure/posix.yml +++ b/build_tools/azure/posix.yml @@ -51,8 +51,8 @@ jobs: # <test_name_1> # <test_name_2> # ... - if [[ "$(COMMIT_MESSAGE)" =~ \[all\ random\ seeds\] ]]; then - message=$(echo $(COMMIT_MESSAGE) | sed -n -e 's/^.*all\ random\ seeds\] //p') + if [[ "$COMMIT_MESSAGE" =~ \[all\ random\ seeds\] ]]; then + message=$(echo $COMMIT_MESSAGE | sed -n -e 's/^.*all\ random\ seeds\] //p') selected="${message// / or }" else selected="" diff --git a/build_tools/azure/windows.yml b/build_tools/azure/windows.yml index 16277ce18c314..b5bb20162195d 100644 --- a/build_tools/azure/windows.yml +++ b/build_tools/azure/windows.yml @@ -35,8 +35,8 @@ jobs: # <test_name_1> # <test_name_2> # ... - if [[ "$(COMMIT_MESSAGE)" =~ \[all\ random\ seeds\] ]]; then - message=$(echo $(COMMIT_MESSAGE) | sed -n -e 's/^.*all\ random\ seeds\] //p') + if [[ "$COMMIT_MESSAGE" =~ \[all\ random\ seeds\] ]]; then + message=$(echo $COMMIT_MESSAGE | sed -n -e 's/^.*all\ random\ seeds\] //p') selected="${message// / or }" else selected="" From d8c3c6e7f3ff93eb77c52c51b40b9420a71f5271 Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Tue, 5 Apr 2022 17:28:51 +0200 Subject: [PATCH 10/36] debug win [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results --- build_tools/azure/windows.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/build_tools/azure/windows.yml b/build_tools/azure/windows.yml index b5bb20162195d..a06500e5ba687 100644 --- a/build_tools/azure/windows.yml +++ b/build_tools/azure/windows.yml @@ -41,6 +41,7 @@ jobs: else selected="" fi + echo $selected echo "##vso[task.setvariable variable=SELECTED_TESTS]$selected" displayName: Check selected tests for all random seeds - bash: echo "##vso[task.prependpath]$CONDA/Scripts" From 147d5400734f2f57b639d2a2fb7396eeb10ff1fc Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Tue, 5 Apr 2022 17:48:39 +0200 Subject: [PATCH 11/36] tst [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results --- build_tools/azure/posix-docker.yml | 2 +- build_tools/azure/posix.yml | 2 +- build_tools/azure/windows.yml | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/build_tools/azure/posix-docker.yml b/build_tools/azure/posix-docker.yml index 8f5d4b67b1a5e..670256e836676 100644 --- a/build_tools/azure/posix-docker.yml +++ b/build_tools/azure/posix-docker.yml @@ -59,7 +59,7 @@ jobs: else selected="" fi - echo "##vso[task.setvariable variable=SELECTED_TESTS]$selected" + echo ##vso[task.setvariable variable=SELECTED_TESTS]$selected displayName: Check selected tests for all random seeds - task: Cache@2 inputs: diff --git a/build_tools/azure/posix.yml b/build_tools/azure/posix.yml index 99ebf90e49adf..8311ff9a0bd26 100644 --- a/build_tools/azure/posix.yml +++ b/build_tools/azure/posix.yml @@ -57,7 +57,7 @@ jobs: else selected="" fi - echo "##vso[task.setvariable variable=SELECTED_TESTS]$selected" + echo ##vso[task.setvariable variable=SELECTED_TESTS]$selected displayName: Check selected tests for all random seeds - bash: echo "##vso[task.prependpath]$CONDA/bin" displayName: Add conda to PATH diff --git a/build_tools/azure/windows.yml b/build_tools/azure/windows.yml index a06500e5ba687..23dc23b304d16 100644 --- a/build_tools/azure/windows.yml +++ b/build_tools/azure/windows.yml @@ -41,8 +41,7 @@ jobs: else selected="" fi - echo $selected - echo "##vso[task.setvariable variable=SELECTED_TESTS]$selected" + echo ##vso[task.setvariable variable=SELECTED_TESTS]$selected displayName: Check selected tests for all random seeds - bash: echo "##vso[task.prependpath]$CONDA/Scripts" displayName: Add conda to PATH for 64 bit Python From 59ac79f9f5934e5ef072f38eb1ec537b0b1272f8 Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Mon, 11 Apr 2022 16:55:02 +0200 Subject: [PATCH 12/36] python script [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results --- build_tools/azure/get_selected_tests.py | 26 +++++++++++++++++++++++++ build_tools/azure/posix-docker.yml | 16 +-------------- build_tools/azure/posix.yml | 16 +-------------- build_tools/azure/windows.yml | 16 +-------------- 4 files changed, 29 insertions(+), 45 deletions(-) create mode 100644 build_tools/azure/get_selected_tests.py diff --git a/build_tools/azure/get_selected_tests.py b/build_tools/azure/get_selected_tests.py new file mode 100644 index 0000000000000..33b47fef4da8d --- /dev/null +++ b/build_tools/azure/get_selected_tests.py @@ -0,0 +1,26 @@ +import os + + +def get_selected_tests(): + """Parse the commit message to check if pytest should run only specific tests. + + The commit message must take the form: + <title> [all random seeds] + <test_name_1> + <test_name_2> + ... + """ + commit_message = os.environ["COMMIT_MESSAGE"] + print(f"commit message: {commit_message}") + + if "[all random seeds]" in commit_message: + selected_tests = commit_message.split("[all random seeds]")[1].strip() + selected_tests = selected_tests.replace(" ", " or ") + else: + selected_tests = "" + + print(f"##vso[task.setvariable variable=SELECTED_TESTS]'{selected_tests}'") + + +if __name__ == "__main__": + get_selected_tests() diff --git a/build_tools/azure/posix-docker.yml b/build_tools/azure/posix-docker.yml index 670256e836676..54c6b01da3d79 100644 --- a/build_tools/azure/posix-docker.yml +++ b/build_tools/azure/posix-docker.yml @@ -45,21 +45,7 @@ jobs: ${{ insert }}: ${{ parameters.matrix }} steps: - - bash: | - set -ex - # Check if run only specific tests but on all random seeds - # commit message must take the form - # <title> [all random seeds] - # <test_name_1> - # <test_name_2> - # ... - if [[ "$COMMIT_MESSAGE" =~ \[all\ random\ seeds\] ]]; then - message=$(echo $COMMIT_MESSAGE | sed -n -e 's/^.*all\ random\ seeds\] //p') - selected="${message// / or }" - else - selected="" - fi - echo ##vso[task.setvariable variable=SELECTED_TESTS]$selected + - script: python build_tools/azure/get_selected_tests.py displayName: Check selected tests for all random seeds - task: Cache@2 inputs: diff --git a/build_tools/azure/posix.yml b/build_tools/azure/posix.yml index 8311ff9a0bd26..493989ba4c3c2 100644 --- a/build_tools/azure/posix.yml +++ b/build_tools/azure/posix.yml @@ -43,21 +43,7 @@ jobs: ${{ insert }}: ${{ parameters.matrix }} steps: - - bash: | - set -ex - # Check if run only specific tests but on all random seeds - # commit message must take the form - # <title> [all random seeds] - # <test_name_1> - # <test_name_2> - # ... - if [[ "$COMMIT_MESSAGE" =~ \[all\ random\ seeds\] ]]; then - message=$(echo $COMMIT_MESSAGE | sed -n -e 's/^.*all\ random\ seeds\] //p') - selected="${message// / or }" - else - selected="" - fi - echo ##vso[task.setvariable variable=SELECTED_TESTS]$selected + - script: python build_tools/azure/get_selected_tests.py displayName: Check selected tests for all random seeds - bash: echo "##vso[task.prependpath]$CONDA/bin" displayName: Add conda to PATH diff --git a/build_tools/azure/windows.yml b/build_tools/azure/windows.yml index 23dc23b304d16..a97bc053df28c 100644 --- a/build_tools/azure/windows.yml +++ b/build_tools/azure/windows.yml @@ -27,21 +27,7 @@ jobs: ${{ insert }}: ${{ parameters.matrix }} steps: - - bash: | - set -ex - # Check if run only specific tests but on all random seeds - # commit message must take the form - # <title> [all random seeds] - # <test_name_1> - # <test_name_2> - # ... - if [[ "$COMMIT_MESSAGE" =~ \[all\ random\ seeds\] ]]; then - message=$(echo $COMMIT_MESSAGE | sed -n -e 's/^.*all\ random\ seeds\] //p') - selected="${message// / or }" - else - selected="" - fi - echo ##vso[task.setvariable variable=SELECTED_TESTS]$selected + - script: python build_tools/azure/get_selected_tests.py displayName: Check selected tests for all random seeds - bash: echo "##vso[task.prependpath]$CONDA/Scripts" displayName: Add conda to PATH for 64 bit Python From 772adfe8ee2c141eeb7e3870e8e1ab10ccf4f131 Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Mon, 11 Apr 2022 17:03:01 +0200 Subject: [PATCH 13/36] python script [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results --- build_tools/azure/get_selected_tests.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build_tools/azure/get_selected_tests.py b/build_tools/azure/get_selected_tests.py index 33b47fef4da8d..aa8ea2ae4ad41 100644 --- a/build_tools/azure/get_selected_tests.py +++ b/build_tools/azure/get_selected_tests.py @@ -11,7 +11,9 @@ def get_selected_tests(): ... """ commit_message = os.environ["COMMIT_MESSAGE"] - print(f"commit message: {commit_message}") + import sys + print(sys.version_info) + # print(f"commit message: {commit_message}") if "[all random seeds]" in commit_message: selected_tests = commit_message.split("[all random seeds]")[1].strip() @@ -19,7 +21,7 @@ def get_selected_tests(): else: selected_tests = "" - print(f"##vso[task.setvariable variable=SELECTED_TESTS]'{selected_tests}'") + # print(f"##vso[task.setvariable variable=SELECTED_TESTS]'{selected_tests}'") if __name__ == "__main__": From 28e545bd3bae0aff23ecd83676b333fb9eda77ee Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Mon, 11 Apr 2022 17:18:23 +0200 Subject: [PATCH 14/36] python script [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results --- build_tools/azure/get_selected_tests.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/build_tools/azure/get_selected_tests.py b/build_tools/azure/get_selected_tests.py index aa8ea2ae4ad41..33b47fef4da8d 100644 --- a/build_tools/azure/get_selected_tests.py +++ b/build_tools/azure/get_selected_tests.py @@ -11,9 +11,7 @@ def get_selected_tests(): ... """ commit_message = os.environ["COMMIT_MESSAGE"] - import sys - print(sys.version_info) - # print(f"commit message: {commit_message}") + print(f"commit message: {commit_message}") if "[all random seeds]" in commit_message: selected_tests = commit_message.split("[all random seeds]")[1].strip() @@ -21,7 +19,7 @@ def get_selected_tests(): else: selected_tests = "" - # print(f"##vso[task.setvariable variable=SELECTED_TESTS]'{selected_tests}'") + print(f"##vso[task.setvariable variable=SELECTED_TESTS]'{selected_tests}'") if __name__ == "__main__": From 156df8d4f0077da143455443104d5e9c723def9a Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Mon, 11 Apr 2022 17:32:26 +0200 Subject: [PATCH 15/36] python script [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results --- build_tools/azure/get_selected_tests.py | 4 ++-- build_tools/azure/test_script.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build_tools/azure/get_selected_tests.py b/build_tools/azure/get_selected_tests.py index 33b47fef4da8d..b01ee2221ba2b 100644 --- a/build_tools/azure/get_selected_tests.py +++ b/build_tools/azure/get_selected_tests.py @@ -11,7 +11,6 @@ def get_selected_tests(): ... """ commit_message = os.environ["COMMIT_MESSAGE"] - print(f"commit message: {commit_message}") if "[all random seeds]" in commit_message: selected_tests = commit_message.split("[all random seeds]")[1].strip() @@ -19,7 +18,8 @@ def get_selected_tests(): else: selected_tests = "" - print(f"##vso[task.setvariable variable=SELECTED_TESTS]'{selected_tests}'") + # set the environment variable to be propagated to other steps + print("##vso[task.setvariable variable=SELECTED_TESTS]'{}'".format(selected_tests)) if __name__ == "__main__": diff --git a/build_tools/azure/test_script.sh b/build_tools/azure/test_script.sh index 53741465015bb..6d7e4a38a5643 100755 --- a/build_tools/azure/test_script.sh +++ b/build_tools/azure/test_script.sh @@ -61,7 +61,7 @@ fi if [[ "$SELECTED_TESTS" != "" ]]; then echo $SELECTED_TESTS - TEST_CMD="$TEST_CMD -k '$SELECTED_TESTS'" + TEST_CMD="$TEST_CMD -k $SELECTED_TESTS" # Override to make selected tests run on all random seeds export SKLEARN_TESTS_GLOBAL_RANDOM_SEED="all" fi From 0fa37183c91ccbd370a1609fd66392c7b3cf8dee Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Mon, 11 Apr 2022 17:50:03 +0200 Subject: [PATCH 16/36] cln [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results --- build_tools/azure/get_selected_tests.py | 2 ++ build_tools/azure/test_script.sh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/build_tools/azure/get_selected_tests.py b/build_tools/azure/get_selected_tests.py index b01ee2221ba2b..b01bb56fcb123 100644 --- a/build_tools/azure/get_selected_tests.py +++ b/build_tools/azure/get_selected_tests.py @@ -4,6 +4,8 @@ def get_selected_tests(): """Parse the commit message to check if pytest should run only specific tests. + If so, selected tests will be run with SKLEARN_TESTS_GLOBAL_RANDOM_SEED="all". + The commit message must take the form: <title> [all random seeds] <test_name_1> diff --git a/build_tools/azure/test_script.sh b/build_tools/azure/test_script.sh index 6d7e4a38a5643..592fbc00ba961 100755 --- a/build_tools/azure/test_script.sh +++ b/build_tools/azure/test_script.sh @@ -60,8 +60,8 @@ if [[ "$SHOW_SHORT_SUMMARY" == "true" ]]; then fi if [[ "$SELECTED_TESTS" != "" ]]; then - echo $SELECTED_TESTS TEST_CMD="$TEST_CMD -k $SELECTED_TESTS" + # Override to make selected tests run on all random seeds export SKLEARN_TESTS_GLOBAL_RANDOM_SEED="all" fi From 0cbaeef71867e76cbea7710d9b32e6e06b58a757 Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Mon, 11 Apr 2022 17:57:46 +0200 Subject: [PATCH 17/36] exp [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results --- azure-pipelines.yml | 2 +- build_tools/azure/get_selected_tests.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0e2767d18896f..f548ef0d5a375 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -21,7 +21,7 @@ jobs: # message is the second to last commit COMMIT_ID=$(echo $BUILD_SOURCEVERSIONMESSAGE | awk '{print $2}') message=$(git log $COMMIT_ID -1 --pretty=%B) - message=$(echo $message) + # message=$(echo $message) else message=$BUILD_SOURCEVERSIONMESSAGE fi diff --git a/build_tools/azure/get_selected_tests.py b/build_tools/azure/get_selected_tests.py index b01bb56fcb123..fb43f1a4f4d45 100644 --- a/build_tools/azure/get_selected_tests.py +++ b/build_tools/azure/get_selected_tests.py @@ -13,6 +13,7 @@ def get_selected_tests(): ... """ commit_message = os.environ["COMMIT_MESSAGE"] + print("commit message", commit_message) if "[all random seeds]" in commit_message: selected_tests = commit_message.split("[all random seeds]")[1].strip() From e63c0bea9ea08e6a35d66d019f08d8a497fef02b Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Mon, 11 Apr 2022 18:03:10 +0200 Subject: [PATCH 18/36] cln [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results --- azure-pipelines.yml | 2 +- build_tools/azure/get_selected_tests.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f548ef0d5a375..0e2767d18896f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -21,7 +21,7 @@ jobs: # message is the second to last commit COMMIT_ID=$(echo $BUILD_SOURCEVERSIONMESSAGE | awk '{print $2}') message=$(git log $COMMIT_ID -1 --pretty=%B) - # message=$(echo $message) + message=$(echo $message) else message=$BUILD_SOURCEVERSIONMESSAGE fi diff --git a/build_tools/azure/get_selected_tests.py b/build_tools/azure/get_selected_tests.py index fb43f1a4f4d45..b01bb56fcb123 100644 --- a/build_tools/azure/get_selected_tests.py +++ b/build_tools/azure/get_selected_tests.py @@ -13,7 +13,6 @@ def get_selected_tests(): ... """ commit_message = os.environ["COMMIT_MESSAGE"] - print("commit message", commit_message) if "[all random seeds]" in commit_message: selected_tests = commit_message.split("[all random seeds]")[1].strip() From 9adbae085bb5eee990a40602ab8d3b8d65d5fcba Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Mon, 11 Apr 2022 18:09:40 +0200 Subject: [PATCH 19/36] condition on pull requests [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results --- build_tools/azure/posix-docker.yml | 1 + build_tools/azure/posix.yml | 1 + build_tools/azure/windows.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/build_tools/azure/posix-docker.yml b/build_tools/azure/posix-docker.yml index 54c6b01da3d79..518c04861c7d4 100644 --- a/build_tools/azure/posix-docker.yml +++ b/build_tools/azure/posix-docker.yml @@ -47,6 +47,7 @@ jobs: steps: - script: python build_tools/azure/get_selected_tests.py displayName: Check selected tests for all random seeds + condition: eq(variables['Build.Reason'], 'PullRequest') - task: Cache@2 inputs: key: '"ccache-v1" | "$(Agent.JobName)" | "$(Build.BuildNumber)"' diff --git a/build_tools/azure/posix.yml b/build_tools/azure/posix.yml index 493989ba4c3c2..8f589a93611e7 100644 --- a/build_tools/azure/posix.yml +++ b/build_tools/azure/posix.yml @@ -45,6 +45,7 @@ jobs: steps: - script: python build_tools/azure/get_selected_tests.py displayName: Check selected tests for all random seeds + condition: eq(variables['Build.Reason'], 'PullRequest') - bash: echo "##vso[task.prependpath]$CONDA/bin" displayName: Add conda to PATH condition: startsWith(variables['DISTRIB'], 'conda') diff --git a/build_tools/azure/windows.yml b/build_tools/azure/windows.yml index a97bc053df28c..63693bbb72919 100644 --- a/build_tools/azure/windows.yml +++ b/build_tools/azure/windows.yml @@ -29,6 +29,7 @@ jobs: steps: - script: python build_tools/azure/get_selected_tests.py displayName: Check selected tests for all random seeds + condition: eq(variables['Build.Reason'], 'PullRequest') - bash: echo "##vso[task.prependpath]$CONDA/Scripts" displayName: Add conda to PATH for 64 bit Python condition: eq(variables['PYTHON_ARCH'], '64') From 9262c35b2166f91dc8380d245f3ec5df0a2e2534 Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Tue, 12 Apr 2022 12:09:58 +0200 Subject: [PATCH 20/36] exp [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results --- build_tools/azure/get_selected_tests.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/build_tools/azure/get_selected_tests.py b/build_tools/azure/get_selected_tests.py index b01bb56fcb123..997df88aa2a00 100644 --- a/build_tools/azure/get_selected_tests.py +++ b/build_tools/azure/get_selected_tests.py @@ -1,6 +1,21 @@ import os +def get_commit_message(): + build_sourceversionmessage = os.environ["BUILD_SOURCEVERSIONMESSAGE"] + print(build_sourceversionmessage) + + + # By default pull requests use refs/pull/PULL_ID/merge as the source branch + # which has a "Merge ID into ID" as a commit message. The latest commit + # message is the second to last commit + # COMMIT_ID=$(echo $BUILD_SOURCEVERSIONMESSAGE | awk '{print $2}') + # message=$(git log $COMMIT_ID -1 --pretty=%B) + # message=$(echo $message) + + # echo "##vso[task.setvariable variable=message;isOutput=true]$message" + + def get_selected_tests(): """Parse the commit message to check if pytest should run only specific tests. @@ -12,7 +27,7 @@ def get_selected_tests(): <test_name_2> ... """ - commit_message = os.environ["COMMIT_MESSAGE"] + commit_message = get_commit_message() if "[all random seeds]" in commit_message: selected_tests = commit_message.split("[all random seeds]")[1].strip() From 7f115753b3f9760fd5601e9fba31323962d7c1d7 Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Tue, 12 Apr 2022 12:29:35 +0200 Subject: [PATCH 21/36] exp [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results --- build_tools/azure/get_selected_tests.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/build_tools/azure/get_selected_tests.py b/build_tools/azure/get_selected_tests.py index 997df88aa2a00..a63be4cc295ef 100644 --- a/build_tools/azure/get_selected_tests.py +++ b/build_tools/azure/get_selected_tests.py @@ -1,11 +1,19 @@ import os +import subprocess def get_commit_message(): + + # By default pull requests use refs/pull/PULL_ID/merge as the source branch + # which has a "Merge ID into ID" as a commit message. The latest commit + # message is the second to last commit build_sourceversionmessage = os.environ["BUILD_SOURCEVERSIONMESSAGE"] - print(build_sourceversionmessage) - + commit_id = build_sourceversionmessage.split()[1] + commit_message = os.popen("git log -1 --pretty=%B {}".format(commit_id)).read() + commit_message = subprocess.run(f"git log -1 --pretty=%B {commit_id}", shell=True, capture_output=True, text=True) + print(commit_message) + return commit_message # By default pull requests use refs/pull/PULL_ID/merge as the source branch # which has a "Merge ID into ID" as a commit message. The latest commit # message is the second to last commit From e0ec52d6e707645af32073d89d2b591ddbec5afa Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Tue, 12 Apr 2022 12:37:38 +0200 Subject: [PATCH 22/36] exp [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results --- build_tools/azure/get_selected_tests.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/build_tools/azure/get_selected_tests.py b/build_tools/azure/get_selected_tests.py index a63be4cc295ef..2768e043828d2 100644 --- a/build_tools/azure/get_selected_tests.py +++ b/build_tools/azure/get_selected_tests.py @@ -9,8 +9,11 @@ def get_commit_message(): # message is the second to last commit build_sourceversionmessage = os.environ["BUILD_SOURCEVERSIONMESSAGE"] commit_id = build_sourceversionmessage.split()[1] - commit_message = os.popen("git log -1 --pretty=%B {}".format(commit_id)).read() - commit_message = subprocess.run(f"git log -1 --pretty=%B {commit_id}", shell=True, capture_output=True, text=True) + + git_cmd = f"git log -1 --pretty=%B {commit_id}" + commit_message = subprocess.run( + git_cmd, shell=True, capture_output=True, text=True + ).stdout.strip() print(commit_message) return commit_message @@ -39,12 +42,12 @@ def get_selected_tests(): if "[all random seeds]" in commit_message: selected_tests = commit_message.split("[all random seeds]")[1].strip() - selected_tests = selected_tests.replace(" ", " or ") + selected_tests = selected_tests.replace("\n", " or ") else: selected_tests = "" # set the environment variable to be propagated to other steps - print("##vso[task.setvariable variable=SELECTED_TESTS]'{}'".format(selected_tests)) + print(f"##vso[task.setvariable variable=SELECTED_TESTS]'{selected_tests}'") if __name__ == "__main__": From 39d4ce1945f0285fbb019b6654f15f91efb73a2c Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Tue, 12 Apr 2022 13:27:16 +0200 Subject: [PATCH 23/36] exp [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results --- azure-pipelines.yml | 14 +------------ build_tools/azure/get_commit_message.py | 26 +++++++++++++++++++++++ build_tools/azure/get_selected_tests.py | 28 +------------------------ 3 files changed, 28 insertions(+), 40 deletions(-) create mode 100644 build_tools/azure/get_commit_message.py diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0e2767d18896f..114a8edf7fcf6 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -13,19 +13,7 @@ jobs: pool: vmImage: ubuntu-20.04 steps: - - bash: | - set -ex - if [[ $BUILD_REASON == "PullRequest" ]]; then - # By default pull requests use refs/pull/PULL_ID/merge as the source branch - # which has a "Merge ID into ID" as a commit message. The latest commit - # message is the second to last commit - COMMIT_ID=$(echo $BUILD_SOURCEVERSIONMESSAGE | awk '{print $2}') - message=$(git log $COMMIT_ID -1 --pretty=%B) - message=$(echo $message) - else - message=$BUILD_SOURCEVERSIONMESSAGE - fi - echo "##vso[task.setvariable variable=message;isOutput=true]$message" + - script: python build_tools/azure/get_commit_message.py name: commit displayName: Get source version message diff --git a/build_tools/azure/get_commit_message.py b/build_tools/azure/get_commit_message.py new file mode 100644 index 0000000000000..4da8c24294323 --- /dev/null +++ b/build_tools/azure/get_commit_message.py @@ -0,0 +1,26 @@ +import os +import subprocess + + +def get_commit_message(): + """Retrieve the commit message.""" + build_source_version_message = os.environ["BUILD_SOURCEVERSIONMESSAGE"] + + if os.environ["BUILD_REASON"] == "PullRequest": + # By default pull requests use refs/pull/PULL_ID/merge as the source branch + # which has a "Merge ID into ID" as a commit message. The latest commit + # message is the second to last commit + commit_id = build_source_version_message.split()[1] + git_cmd = f"git log {commit_id} -1 --pretty=%B " + commit_message = subprocess.run( + git_cmd, shell=True, capture_output=True, text=True + ).stdout.strip() + else: + commit_message = build_source_version_message + + return commit_message + + +if __name__ == "__main__": + commit_message = get_commit_message() + print(f"##vso[task.setvariable variable=message;isOutput=true]{commit_message}") diff --git a/build_tools/azure/get_selected_tests.py b/build_tools/azure/get_selected_tests.py index 2768e043828d2..00a56ad22620d 100644 --- a/build_tools/azure/get_selected_tests.py +++ b/build_tools/azure/get_selected_tests.py @@ -1,30 +1,4 @@ -import os -import subprocess - - -def get_commit_message(): - - # By default pull requests use refs/pull/PULL_ID/merge as the source branch - # which has a "Merge ID into ID" as a commit message. The latest commit - # message is the second to last commit - build_sourceversionmessage = os.environ["BUILD_SOURCEVERSIONMESSAGE"] - commit_id = build_sourceversionmessage.split()[1] - - git_cmd = f"git log -1 --pretty=%B {commit_id}" - commit_message = subprocess.run( - git_cmd, shell=True, capture_output=True, text=True - ).stdout.strip() - - print(commit_message) - return commit_message - # By default pull requests use refs/pull/PULL_ID/merge as the source branch - # which has a "Merge ID into ID" as a commit message. The latest commit - # message is the second to last commit - # COMMIT_ID=$(echo $BUILD_SOURCEVERSIONMESSAGE | awk '{print $2}') - # message=$(git log $COMMIT_ID -1 --pretty=%B) - # message=$(echo $message) - - # echo "##vso[task.setvariable variable=message;isOutput=true]$message" +from .get_commit_message import get_commit_message def get_selected_tests(): From d9dfa52c8a08ac815778d5af213286e71dc2a1fc Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Tue, 12 Apr 2022 13:39:20 +0200 Subject: [PATCH 24/36] exp [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results --- build_tools/azure/get_selected_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_tools/azure/get_selected_tests.py b/build_tools/azure/get_selected_tests.py index 00a56ad22620d..3fcf0001506fc 100644 --- a/build_tools/azure/get_selected_tests.py +++ b/build_tools/azure/get_selected_tests.py @@ -1,4 +1,4 @@ -from .get_commit_message import get_commit_message +from get_commit_message import get_commit_message def get_selected_tests(): From b6d830fc021978a948b4d74d476b4547ab1b0257 Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Tue, 12 Apr 2022 14:02:37 +0200 Subject: [PATCH 25/36] exp [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results --- azure-pipelines.yml | 1 - build_tools/azure/posix-docker.yml | 9 +++------ build_tools/azure/posix.yml | 9 +++------ build_tools/azure/windows.yml | 10 +++++----- 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 114a8edf7fcf6..3ac779c8e4b93 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -16,7 +16,6 @@ jobs: - script: python build_tools/azure/get_commit_message.py name: commit displayName: Get source version message - - job: linting dependsOn: [git_commit] condition: | diff --git a/build_tools/azure/posix-docker.yml b/build_tools/azure/posix-docker.yml index 518c04861c7d4..aca0ac0e20611 100644 --- a/build_tools/azure/posix-docker.yml +++ b/build_tools/azure/posix-docker.yml @@ -45,6 +45,9 @@ jobs: ${{ insert }}: ${{ parameters.matrix }} steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: '3.9' - script: python build_tools/azure/get_selected_tests.py displayName: Check selected tests for all random seeds condition: eq(variables['Build.Reason'], 'PullRequest') @@ -111,12 +114,6 @@ jobs: docker container stop skcontainer displayName: 'Stop container' condition: always() - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.9' - displayName: Place Python into path to update issue tracker - condition: and(succeededOrFailed(), eq(variables['CREATE_ISSUE_ON_TRACKER'], 'true'), - eq(variables['Build.Reason'], 'Schedule')) - bash: | set -ex if [[ $(BOT_GITHUB_TOKEN) == "" ]]; then diff --git a/build_tools/azure/posix.yml b/build_tools/azure/posix.yml index 8f589a93611e7..d6cab5ff2f4c7 100644 --- a/build_tools/azure/posix.yml +++ b/build_tools/azure/posix.yml @@ -43,6 +43,9 @@ jobs: ${{ insert }}: ${{ parameters.matrix }} steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: '3.9' - script: python build_tools/azure/get_selected_tests.py displayName: Check selected tests for all random seeds condition: eq(variables['Build.Reason'], 'PullRequest') @@ -81,12 +84,6 @@ jobs: testRunTitle: ${{ format('{0}-$(Agent.JobName)', parameters.name) }} displayName: 'Publish Test Results' condition: succeededOrFailed() - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.9' - displayName: Place Python into path to update issue tracker - condition: and(succeededOrFailed(), eq(variables['CREATE_ISSUE_ON_TRACKER'], 'true'), - eq(variables['Build.Reason'], 'Schedule')) - bash: | set -ex if [[ $(BOT_GITHUB_TOKEN) == "" ]]; then diff --git a/build_tools/azure/windows.yml b/build_tools/azure/windows.yml index 63693bbb72919..22da583d80dfa 100644 --- a/build_tools/azure/windows.yml +++ b/build_tools/azure/windows.yml @@ -27,17 +27,17 @@ jobs: ${{ insert }}: ${{ parameters.matrix }} steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: '$(PYTHON_VERSION)' + addToPath: true + architecture: 'x86' - script: python build_tools/azure/get_selected_tests.py displayName: Check selected tests for all random seeds condition: eq(variables['Build.Reason'], 'PullRequest') - bash: echo "##vso[task.prependpath]$CONDA/Scripts" displayName: Add conda to PATH for 64 bit Python condition: eq(variables['PYTHON_ARCH'], '64') - - task: UsePythonVersion@0 - inputs: - versionSpec: '$(PYTHON_VERSION)' - addToPath: true - architecture: 'x86' displayName: Use 32 bit System Python condition: eq(variables['PYTHON_ARCH'], '32') - bash: ./build_tools/azure/install_win.sh From 37ce49dd70b3571b33a36c3bb7c0bd234fd00706 Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Tue, 12 Apr 2022 14:10:05 +0200 Subject: [PATCH 26/36] cln [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results --- azure-pipelines.yml | 3 ++- build_tools/azure/posix-docker.yml | 2 +- build_tools/azure/posix.yml | 2 +- build_tools/azure/windows.yml | 10 +++++----- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 3ac779c8e4b93..abd3efdeb649f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -13,9 +13,10 @@ jobs: pool: vmImage: ubuntu-20.04 steps: - - script: python build_tools/azure/get_commit_message.py + - bash: python build_tools/azure/get_commit_message.py name: commit displayName: Get source version message + - job: linting dependsOn: [git_commit] condition: | diff --git a/build_tools/azure/posix-docker.yml b/build_tools/azure/posix-docker.yml index aca0ac0e20611..109edd5430ebf 100644 --- a/build_tools/azure/posix-docker.yml +++ b/build_tools/azure/posix-docker.yml @@ -48,7 +48,7 @@ jobs: - task: UsePythonVersion@0 inputs: versionSpec: '3.9' - - script: python build_tools/azure/get_selected_tests.py + - bash: python build_tools/azure/get_selected_tests.py displayName: Check selected tests for all random seeds condition: eq(variables['Build.Reason'], 'PullRequest') - task: Cache@2 diff --git a/build_tools/azure/posix.yml b/build_tools/azure/posix.yml index d6cab5ff2f4c7..2c18dc2164864 100644 --- a/build_tools/azure/posix.yml +++ b/build_tools/azure/posix.yml @@ -46,7 +46,7 @@ jobs: - task: UsePythonVersion@0 inputs: versionSpec: '3.9' - - script: python build_tools/azure/get_selected_tests.py + - bash: python build_tools/azure/get_selected_tests.py displayName: Check selected tests for all random seeds condition: eq(variables['Build.Reason'], 'PullRequest') - bash: echo "##vso[task.prependpath]$CONDA/bin" diff --git a/build_tools/azure/windows.yml b/build_tools/azure/windows.yml index 22da583d80dfa..9dea51da49252 100644 --- a/build_tools/azure/windows.yml +++ b/build_tools/azure/windows.yml @@ -32,14 +32,14 @@ jobs: versionSpec: '$(PYTHON_VERSION)' addToPath: true architecture: 'x86' - - script: python build_tools/azure/get_selected_tests.py - displayName: Check selected tests for all random seeds - condition: eq(variables['Build.Reason'], 'PullRequest') + displayName: Use 32 bit System Python + condition: eq(variables['PYTHON_ARCH'], '32') - bash: echo "##vso[task.prependpath]$CONDA/Scripts" displayName: Add conda to PATH for 64 bit Python condition: eq(variables['PYTHON_ARCH'], '64') - displayName: Use 32 bit System Python - condition: eq(variables['PYTHON_ARCH'], '32') + - bash: python build_tools/azure/get_selected_tests.py + displayName: Check selected tests for all random seeds + condition: eq(variables['Build.Reason'], 'PullRequest') - bash: ./build_tools/azure/install_win.sh displayName: 'Install' - bash: ./build_tools/azure/test_script.sh From 30aa92f595d5a9e52ec2dad82ac01aa4d709f996 Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Tue, 12 Apr 2022 14:38:36 +0200 Subject: [PATCH 27/36] cln [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results --- build_tools/azure/get_commit_message.py | 1 + build_tools/azure/get_selected_tests.py | 9 +++++---- build_tools/azure/posix-docker.yml | 10 ++++++---- build_tools/azure/posix.yml | 1 - build_tools/azure/windows.yml | 1 - 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/build_tools/azure/get_commit_message.py b/build_tools/azure/get_commit_message.py index 4da8c24294323..5859e66e1db3f 100644 --- a/build_tools/azure/get_commit_message.py +++ b/build_tools/azure/get_commit_message.py @@ -22,5 +22,6 @@ def get_commit_message(): if __name__ == "__main__": + # set the environment variable to be propagated to other steps commit_message = get_commit_message() print(f"##vso[task.setvariable variable=message;isOutput=true]{commit_message}") diff --git a/build_tools/azure/get_selected_tests.py b/build_tools/azure/get_selected_tests.py index 3fcf0001506fc..7d92d43ef497b 100644 --- a/build_tools/azure/get_selected_tests.py +++ b/build_tools/azure/get_selected_tests.py @@ -20,9 +20,10 @@ def get_selected_tests(): else: selected_tests = "" - # set the environment variable to be propagated to other steps - print(f"##vso[task.setvariable variable=SELECTED_TESTS]'{selected_tests}'") - + return selected_tests + if __name__ == "__main__": - get_selected_tests() + # set the environment variable to be propagated to other steps + selected_tests = get_selected_tests() + print(f"##vso[task.setvariable variable=SELECTED_TESTS]'{selected_tests}'") diff --git a/build_tools/azure/posix-docker.yml b/build_tools/azure/posix-docker.yml index 109edd5430ebf..66a081449c2f9 100644 --- a/build_tools/azure/posix-docker.yml +++ b/build_tools/azure/posix-docker.yml @@ -32,7 +32,6 @@ jobs: COVERAGE: 'false' TEST_DOCSTRINGS: 'false' BLAS: 'openblas' - COMMIT_MESSAGE: $[ dependencies.git_commit.outputs['commit.message'] ] # Set in azure-pipelines.yml DISTRIB: '' DOCKER_CONTAINER: '' @@ -45,9 +44,6 @@ jobs: ${{ insert }}: ${{ parameters.matrix }} steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.9' - bash: python build_tools/azure/get_selected_tests.py displayName: Check selected tests for all random seeds condition: eq(variables['Build.Reason'], 'PullRequest') @@ -114,6 +110,12 @@ jobs: docker container stop skcontainer displayName: 'Stop container' condition: always() + - task: UsePythonVersion@0 + inputs: + versionSpec: '3.9' + displayName: Place Python into path to update issue tracker + condition: and(succeededOrFailed(), eq(variables['CREATE_ISSUE_ON_TRACKER'], 'true'), + eq(variables['Build.Reason'], 'Schedule')) - bash: | set -ex if [[ $(BOT_GITHUB_TOKEN) == "" ]]; then diff --git a/build_tools/azure/posix.yml b/build_tools/azure/posix.yml index 2c18dc2164864..2eaac8fe6ad63 100644 --- a/build_tools/azure/posix.yml +++ b/build_tools/azure/posix.yml @@ -37,7 +37,6 @@ jobs: TEST_DOCSTRINGS: 'false' CREATE_ISSUE_ON_TRACKER: 'false' SHOW_SHORT_SUMMARY: 'false' - COMMIT_MESSAGE: $[ dependencies.git_commit.outputs['commit.message'] ] strategy: matrix: ${{ insert }}: ${{ parameters.matrix }} diff --git a/build_tools/azure/windows.yml b/build_tools/azure/windows.yml index 9dea51da49252..b7becbac19863 100644 --- a/build_tools/azure/windows.yml +++ b/build_tools/azure/windows.yml @@ -21,7 +21,6 @@ jobs: TEST_DIR: '$(Agent.WorkFolder)/tmp_folder' SHOW_SHORT_SUMMARY: 'false' CPU_COUNT: '2' - COMMIT_MESSAGE: $[ dependencies.git_commit.outputs['commit.message'] ] strategy: matrix: ${{ insert }}: ${{ parameters.matrix }} From 576d3ab207a767a89bdbe9fb171f7dd1b4f5a7b6 Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Tue, 12 Apr 2022 14:42:19 +0200 Subject: [PATCH 28/36] lint [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results --- build_tools/azure/get_selected_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_tools/azure/get_selected_tests.py b/build_tools/azure/get_selected_tests.py index 7d92d43ef497b..8a7c8c5d82374 100644 --- a/build_tools/azure/get_selected_tests.py +++ b/build_tools/azure/get_selected_tests.py @@ -21,7 +21,7 @@ def get_selected_tests(): selected_tests = "" return selected_tests - + if __name__ == "__main__": # set the environment variable to be propagated to other steps From b180ecd361cc86ae98d98a948218c10ee07ddd69 Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Tue, 12 Apr 2022 14:49:43 +0200 Subject: [PATCH 29/36] cln [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results --- build_tools/azure/windows.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build_tools/azure/windows.yml b/build_tools/azure/windows.yml index b7becbac19863..3e1d282f3d79a 100644 --- a/build_tools/azure/windows.yml +++ b/build_tools/azure/windows.yml @@ -26,6 +26,12 @@ jobs: ${{ insert }}: ${{ parameters.matrix }} steps: + - bash: python build_tools/azure/get_selected_tests.py + displayName: Check selected tests for all random seeds + condition: eq(variables['Build.Reason'], 'PullRequest') + - bash: echo "##vso[task.prependpath]$CONDA/Scripts" + displayName: Add conda to PATH for 64 bit Python + condition: eq(variables['PYTHON_ARCH'], '64') - task: UsePythonVersion@0 inputs: versionSpec: '$(PYTHON_VERSION)' @@ -33,12 +39,6 @@ jobs: architecture: 'x86' displayName: Use 32 bit System Python condition: eq(variables['PYTHON_ARCH'], '32') - - bash: echo "##vso[task.prependpath]$CONDA/Scripts" - displayName: Add conda to PATH for 64 bit Python - condition: eq(variables['PYTHON_ARCH'], '64') - - bash: python build_tools/azure/get_selected_tests.py - displayName: Check selected tests for all random seeds - condition: eq(variables['Build.Reason'], 'PullRequest') - bash: ./build_tools/azure/install_win.sh displayName: 'Install' - bash: ./build_tools/azure/test_script.sh From 9e4c0303fd83740ef59d9fdfb5772063bdf9cd0f Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Tue, 12 Apr 2022 15:02:32 +0200 Subject: [PATCH 30/36] cln [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results --- build_tools/azure/posix.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/build_tools/azure/posix.yml b/build_tools/azure/posix.yml index 2eaac8fe6ad63..5f17fc646e9f4 100644 --- a/build_tools/azure/posix.yml +++ b/build_tools/azure/posix.yml @@ -42,9 +42,6 @@ jobs: ${{ insert }}: ${{ parameters.matrix }} steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.9' - bash: python build_tools/azure/get_selected_tests.py displayName: Check selected tests for all random seeds condition: eq(variables['Build.Reason'], 'PullRequest') @@ -83,6 +80,12 @@ jobs: testRunTitle: ${{ format('{0}-$(Agent.JobName)', parameters.name) }} displayName: 'Publish Test Results' condition: succeededOrFailed() + - task: UsePythonVersion@0 + inputs: + versionSpec: '3.9' + displayName: Place Python into path to update issue tracker + condition: and(succeededOrFailed(), eq(variables['CREATE_ISSUE_ON_TRACKER'], 'true'), + eq(variables['Build.Reason'], 'Schedule')) - bash: | set -ex if [[ $(BOT_GITHUB_TOKEN) == "" ]]; then From 7ca55673deee9f314f3f99bf413e0736e3534748 Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Tue, 12 Apr 2022 15:20:39 +0200 Subject: [PATCH 31/36] cln [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results --- build_tools/azure/get_selected_tests.py | 2 +- build_tools/azure/posix.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build_tools/azure/get_selected_tests.py b/build_tools/azure/get_selected_tests.py index 8a7c8c5d82374..2724761173d07 100644 --- a/build_tools/azure/get_selected_tests.py +++ b/build_tools/azure/get_selected_tests.py @@ -26,4 +26,4 @@ def get_selected_tests(): if __name__ == "__main__": # set the environment variable to be propagated to other steps selected_tests = get_selected_tests() - print(f"##vso[task.setvariable variable=SELECTED_TESTS]'{selected_tests}'") + print("##vso[task.setvariable variable=SELECTED_TESTS]'{}'".format(selected_tests)) diff --git a/build_tools/azure/posix.yml b/build_tools/azure/posix.yml index 5f17fc646e9f4..43f036ffa99df 100644 --- a/build_tools/azure/posix.yml +++ b/build_tools/azure/posix.yml @@ -83,9 +83,9 @@ jobs: - task: UsePythonVersion@0 inputs: versionSpec: '3.9' - displayName: Place Python into path to update issue tracker - condition: and(succeededOrFailed(), eq(variables['CREATE_ISSUE_ON_TRACKER'], 'true'), - eq(variables['Build.Reason'], 'Schedule')) + displayName: Place Python into path to update issue tracker + condition: and(succeededOrFailed(), eq(variables['CREATE_ISSUE_ON_TRACKER'], 'true'), + eq(variables['Build.Reason'], 'Schedule')) - bash: | set -ex if [[ $(BOT_GITHUB_TOKEN) == "" ]]; then From 0bf0b30aaf812930559b6c7bd675c1ff7d12e7ba Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Tue, 12 Apr 2022 15:28:42 +0200 Subject: [PATCH 32/36] cln [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results --- build_tools/azure/get_commit_message.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_tools/azure/get_commit_message.py b/build_tools/azure/get_commit_message.py index 5859e66e1db3f..60564d8085dd9 100644 --- a/build_tools/azure/get_commit_message.py +++ b/build_tools/azure/get_commit_message.py @@ -11,7 +11,7 @@ def get_commit_message(): # which has a "Merge ID into ID" as a commit message. The latest commit # message is the second to last commit commit_id = build_source_version_message.split()[1] - git_cmd = f"git log {commit_id} -1 --pretty=%B " + git_cmd = "git log {} -1 --pretty=%B ".format(commit_id) commit_message = subprocess.run( git_cmd, shell=True, capture_output=True, text=True ).stdout.strip() From 2f51d13a3f2b5b4277c9b2100c38f0321c802e5b Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Tue, 12 Apr 2022 16:07:11 +0200 Subject: [PATCH 33/36] cln [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results --- build_tools/azure/get_commit_message.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build_tools/azure/get_commit_message.py b/build_tools/azure/get_commit_message.py index 60564d8085dd9..ab80eb7c7bb70 100644 --- a/build_tools/azure/get_commit_message.py +++ b/build_tools/azure/get_commit_message.py @@ -23,5 +23,5 @@ def get_commit_message(): if __name__ == "__main__": # set the environment variable to be propagated to other steps - commit_message = get_commit_message() - print(f"##vso[task.setvariable variable=message;isOutput=true]{commit_message}") + message = get_commit_message() + print("##vso[task.setvariable variable=message;isOutput=true]{}".format(message)) From 2df77861e6c5453da62c63ea2adc2c4d6e74ba5d Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Tue, 12 Apr 2022 16:25:36 +0200 Subject: [PATCH 34/36] exp [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results --- build_tools/azure/posix.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/build_tools/azure/posix.yml b/build_tools/azure/posix.yml index 43f036ffa99df..11246729b4144 100644 --- a/build_tools/azure/posix.yml +++ b/build_tools/azure/posix.yml @@ -42,7 +42,13 @@ jobs: ${{ insert }}: ${{ parameters.matrix }} steps: - - bash: python build_tools/azure/get_selected_tests.py + - task: UsePythonVersion@0 + inputs: + versionSpec: '3.9' + addToPath: false + name: pyTools + displayName: Select python version to run CI python scripts + - bash: $(pyTools.pythonLocation)/bin/python build_tools/azure/get_selected_tests.py displayName: Check selected tests for all random seeds condition: eq(variables['Build.Reason'], 'PullRequest') - bash: echo "##vso[task.prependpath]$CONDA/bin" @@ -80,12 +86,6 @@ jobs: testRunTitle: ${{ format('{0}-$(Agent.JobName)', parameters.name) }} displayName: 'Publish Test Results' condition: succeededOrFailed() - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.9' - displayName: Place Python into path to update issue tracker - condition: and(succeededOrFailed(), eq(variables['CREATE_ISSUE_ON_TRACKER'], 'true'), - eq(variables['Build.Reason'], 'Schedule')) - bash: | set -ex if [[ $(BOT_GITHUB_TOKEN) == "" ]]; then @@ -97,8 +97,8 @@ jobs: CI_NAME="$SYSTEM_JOBIDENTIFIER" ISSUE_REPO="$BUILD_REPOSITORY_NAME" - pip install defusedxml PyGithub - python maint_tools/update_tracking_issue.py \ + $(pyTools.pythonLocation)/bin/pip install defusedxml PyGithub + $(pyTools.pythonLocation)/bin/python maint_tools/update_tracking_issue.py \ $(BOT_GITHUB_TOKEN) \ $CI_NAME \ $ISSUE_REPO \ From 5a1f29fd9002f8581ab99f46c54b27e4adc5cf9c Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Tue, 12 Apr 2022 16:47:24 +0200 Subject: [PATCH 35/36] exp [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results --- build_tools/azure/get_commit_message.py | 6 +++--- build_tools/azure/get_selected_tests.py | 2 +- build_tools/azure/posix-docker.yml | 18 +++++++++--------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/build_tools/azure/get_commit_message.py b/build_tools/azure/get_commit_message.py index ab80eb7c7bb70..4c02f1a62cc86 100644 --- a/build_tools/azure/get_commit_message.py +++ b/build_tools/azure/get_commit_message.py @@ -11,7 +11,7 @@ def get_commit_message(): # which has a "Merge ID into ID" as a commit message. The latest commit # message is the second to last commit commit_id = build_source_version_message.split()[1] - git_cmd = "git log {} -1 --pretty=%B ".format(commit_id) + git_cmd = f"git log {commit_id} -1 --pretty=%B" commit_message = subprocess.run( git_cmd, shell=True, capture_output=True, text=True ).stdout.strip() @@ -23,5 +23,5 @@ def get_commit_message(): if __name__ == "__main__": # set the environment variable to be propagated to other steps - message = get_commit_message() - print("##vso[task.setvariable variable=message;isOutput=true]{}".format(message)) + commit_message = get_commit_message() + print(f"##vso[task.setvariable variable=message;isOutput=true]{commit_message}") diff --git a/build_tools/azure/get_selected_tests.py b/build_tools/azure/get_selected_tests.py index 2724761173d07..8a7c8c5d82374 100644 --- a/build_tools/azure/get_selected_tests.py +++ b/build_tools/azure/get_selected_tests.py @@ -26,4 +26,4 @@ def get_selected_tests(): if __name__ == "__main__": # set the environment variable to be propagated to other steps selected_tests = get_selected_tests() - print("##vso[task.setvariable variable=SELECTED_TESTS]'{}'".format(selected_tests)) + print(f"##vso[task.setvariable variable=SELECTED_TESTS]'{selected_tests}'") diff --git a/build_tools/azure/posix-docker.yml b/build_tools/azure/posix-docker.yml index 66a081449c2f9..93e423e4902c4 100644 --- a/build_tools/azure/posix-docker.yml +++ b/build_tools/azure/posix-docker.yml @@ -44,7 +44,13 @@ jobs: ${{ insert }}: ${{ parameters.matrix }} steps: - - bash: python build_tools/azure/get_selected_tests.py + - task: UsePythonVersion@0 + inputs: + versionSpec: '3.9' + addToPath: false + name: pyTools + displayName: Select python version to run CI python scripts + - bash: $(pyTools.pythonLocation)/bin/python build_tools/azure/get_selected_tests.py displayName: Check selected tests for all random seeds condition: eq(variables['Build.Reason'], 'PullRequest') - task: Cache@2 @@ -110,12 +116,6 @@ jobs: docker container stop skcontainer displayName: 'Stop container' condition: always() - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.9' - displayName: Place Python into path to update issue tracker - condition: and(succeededOrFailed(), eq(variables['CREATE_ISSUE_ON_TRACKER'], 'true'), - eq(variables['Build.Reason'], 'Schedule')) - bash: | set -ex if [[ $(BOT_GITHUB_TOKEN) == "" ]]; then @@ -127,8 +127,8 @@ jobs: CI_NAME="$SYSTEM_JOBIDENTIFIER" ISSUE_REPO="$BUILD_REPOSITORY_NAME" - pip install defusedxml PyGithub - python maint_tools/update_tracking_issue.py \ + $(pyTools.pythonLocation)/bin/pip install defusedxml PyGithub + $(pyTools.pythonLocation)/bin/python maint_tools/update_tracking_issue.py \ $(BOT_GITHUB_TOKEN) \ $CI_NAME \ $ISSUE_REPO \ From 9e36617089211d922d497ba442a741206e686e9c Mon Sep 17 00:00:00 2001 From: jeremie du boisberranger <jeremiedbb@yahoo.fr> Date: Wed, 13 Apr 2022 21:15:22 +0200 Subject: [PATCH 36/36] adress comments [all random seeds] test_kmeans_plusplus_norms test_kmeans_elkan_results --- build_tools/azure/get_commit_message.py | 6 ++++-- build_tools/azure/get_selected_tests.py | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/build_tools/azure/get_commit_message.py b/build_tools/azure/get_commit_message.py index 4c02f1a62cc86..d20bf99139071 100644 --- a/build_tools/azure/get_commit_message.py +++ b/build_tools/azure/get_commit_message.py @@ -11,9 +11,9 @@ def get_commit_message(): # which has a "Merge ID into ID" as a commit message. The latest commit # message is the second to last commit commit_id = build_source_version_message.split()[1] - git_cmd = f"git log {commit_id} -1 --pretty=%B" + git_cmd = ["git", "log", commit_id, "-1", "--pretty=%B"] commit_message = subprocess.run( - git_cmd, shell=True, capture_output=True, text=True + git_cmd, capture_output=True, text=True ).stdout.strip() else: commit_message = build_source_version_message @@ -25,3 +25,5 @@ def get_commit_message(): # set the environment variable to be propagated to other steps commit_message = get_commit_message() print(f"##vso[task.setvariable variable=message;isOutput=true]{commit_message}") + + print(f"commit message: {commit_message}") # helps debugging diff --git a/build_tools/azure/get_selected_tests.py b/build_tools/azure/get_selected_tests.py index 8a7c8c5d82374..09b8a6eef5b28 100644 --- a/build_tools/azure/get_selected_tests.py +++ b/build_tools/azure/get_selected_tests.py @@ -27,3 +27,5 @@ def get_selected_tests(): # set the environment variable to be propagated to other steps selected_tests = get_selected_tests() print(f"##vso[task.setvariable variable=SELECTED_TESTS]'{selected_tests}'") + + print(f"selected tests: {selected_tests}") # helps debugging