Skip to content

CI allow to run only selected tests but on all random seeds - #23026

Merged
ogrisel merged 37 commits into
scikit-learn:mainfrom
jeremiedbb:tst-random-seed-all
Apr 20, 2022
Merged

ogrisel merged 37 commits into
scikit-learn:mainfrom
jeremiedbb:tst-random-seed-all

Conversation

@jeremiedbb

Copy link
Copy Markdown
Member

When using the global_random_seed fixture in new tests, we check that it works locally on all random seeds but it can happen that some seeds still fail on different platform (see #23014).

This PR gives the possibility to run the CI (azure) on only a given set of tests, for all random seeds, based on the commit message. It will trigger if the commit message is of the form:

<title> [all random seeds]
<test_name_1>
<test_name_2>
...

@jeremiedbb

Copy link
Copy Markdown
Member Author

TODO: skip azure linting (partially because next jobs depend on its success)
TODO: skip circleci

@jeremiedbb

Copy link
Copy Markdown
Member Author

@thomasjpfan do you think it would be possible to create a workflow that triggers on some comment in the PR and pushes to the branch ?

Also do you know why the linux docker job fails because I'm just trying to add a new env var ?

@thomasjpfan thomasjpfan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thomasjpfan do you think it would be possible to create a workflow that triggers on some comment in the PR and pushes to the branch ?

Yes. The easiest way to do it is with GitHub Actions. Although, we would need to be careful about who can activate the command tho.

Comment thread build_tools/azure/posix.yml Outdated
TEST_DOCSTRINGS: 'false'
CREATE_ISSUE_ON_TRACKER: 'false'
SHOW_SHORT_SUMMARY: 'false'
SELECTED_TESTS: $[ dependencies.git_commit.outputs['commit.selected'] ]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than having git_commit parses the commit message and pass it here, can we have a new step in poxis.yml that parses the commit message and pass it along to the next steps?

The upside is that the test configuration is responsible for parsing the commit to select tests and not the git_commit job. The downside is that we need to repeat a little bit of code for extracting the commit, but I think it's easier for future maintainers compared to using a dependencies.git_commit.

Comment thread build_tools/azure/posix-docker.yml Outdated
-e OPENBLAS_NUM_THREADS=$OPENBLAS_NUM_THREADS
-e SKLEARN_SKIP_NETWORK_TESTS=$SKLEARN_SKIP_NETWORK_TESTS
-e BLAS=$BLAS
-e SELECTED_TESTS=$SELECTED_TESTS

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also do you know why the linux docker job fails because I'm just trying to add a new env var ?

The error is weird. My guess is that the brackets ([]) in $SELECTED_TESTS is making bash parse the command weirdly. Maybe this works:

Suggested change
-e SELECTED_TESTS=$SELECTED_TESTS
-e SELECTED_TESTS="$SELECTED_TESTS"

test_kmeans_plusplus_norms
test_kmeans_elkan_results
test_kmeans_plusplus_norms
test_kmeans_elkan_results
test_kmeans_plusplus_norms
test_kmeans_elkan_results
test_kmeans_plusplus_norms
test_kmeans_elkan_results
test_kmeans_plusplus_norms
test_kmeans_elkan_results
test_kmeans_plusplus_norms
test_kmeans_elkan_results
test_kmeans_plusplus_norms
test_kmeans_elkan_results
test_kmeans_plusplus_norms
test_kmeans_elkan_results
Comment thread azure-pipelines.yml Resolved
Comment thread build_tools/azure/posix.yml Resolved
Comment thread build_tools/azure/posix-docker.yml Outdated
# <test_name_2>
# ...
if [[ "$COMMIT_MESSAGE" =~ \[all\ random\ seeds\] ]]; then
message=$(echo $COMMIT_MESSAGE | sed -n -e 's/^.*all\ random\ seeds\] //p')

@thomasjpfan thomasjpfan Apr 5, 2022 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think unix commands harder to maintain in the long run. What do you think of using a simple Python script to parse the commit message and return the selected tests?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, I moved that in a python script

test_kmeans_plusplus_norms
test_kmeans_elkan_results
test_kmeans_plusplus_norms
test_kmeans_elkan_results
test_kmeans_plusplus_norms
test_kmeans_elkan_results
test_kmeans_plusplus_norms
test_kmeans_elkan_results
test_kmeans_plusplus_norms
test_kmeans_elkan_results
test_kmeans_plusplus_norms
test_kmeans_elkan_results
test_kmeans_plusplus_norms
test_kmeans_elkan_results
test_kmeans_plusplus_norms
test_kmeans_elkan_results
@jeremiedbb jeremiedbb changed the title WIP CI allow to run only selected tests but on all random seeds CI allow to run only selected tests but on all random seeds Apr 11, 2022
Comment thread build_tools/azure/get_selected_tests.py Resolved
test_kmeans_plusplus_norms
test_kmeans_elkan_results
test_kmeans_plusplus_norms
test_kmeans_elkan_results
test_kmeans_plusplus_norms
test_kmeans_elkan_results
test_kmeans_plusplus_norms
test_kmeans_elkan_results
test_kmeans_plusplus_norms
test_kmeans_elkan_results
test_kmeans_plusplus_norms
test_kmeans_elkan_results
test_kmeans_plusplus_norms
test_kmeans_elkan_results
test_kmeans_plusplus_norms
test_kmeans_elkan_results
test_kmeans_plusplus_norms
test_kmeans_elkan_results
test_kmeans_plusplus_norms
test_kmeans_elkan_results
test_kmeans_plusplus_norms
test_kmeans_elkan_results
test_kmeans_plusplus_norms
test_kmeans_elkan_results
test_kmeans_plusplus_norms
test_kmeans_elkan_results
test_kmeans_plusplus_norms
test_kmeans_elkan_results
test_kmeans_plusplus_norms
test_kmeans_elkan_results
test_kmeans_plusplus_norms
test_kmeans_elkan_results
Comment thread build_tools/azure/get_commit_message.py Resolved
Comment thread build_tools/azure/get_commit_message.py Resolved

@thomasjpfan thomasjpfan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ogrisel ogrisel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants