Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove verify_parallel_map script #8962

Merged
merged 2 commits into from
Nov 1, 2022

Conversation

mtreinish
Copy link
Member

@mtreinish mtreinish commented Oct 19, 2022

Summary

In #7658 we disabled multiprocessing as part of unittest runs in CI
because the multiple layers of parallelism (subprocess from stestr,
multiprocessing from qiskit, and multithreading from rust in qiskit)
were triggering a latent bug in python's multiprocessing implementation
that was blocking CI. To counter the lost coverage from disabling
multiprocessing in that PR we added a script verify_parallel_map which
force enabled multiprocessing and validated transpile() run in parallel
executed correctly. However, in #8952 we introduced a model for
selectively enabling multiprocessing just for a single test method. This
should allow us to avoid the stochastic failure triggering the deadlock
in python's multiprocessing by overloading parallelism but still test in
isolation that parallel_map() works.

This commit builds on the test class introduced in #8952 and adds
identical test cases to what was previously in verify_parallel_map.py to
move that coverage into the unit test suite. Then the
verify_parallel_map script is removed and all callers are updated to
just run unit tests instead of also executing that script.

Details and comments

This PR is based on top of #8952, I've marked this as on hold until #8952 merges
and this PR branch is rebased.

@mtreinish mtreinish added on hold Can not fix yet type: qa Issues and PRs that relate to testing and code quality Changelog: None Do not include in changelog labels Oct 19, 2022
@mtreinish mtreinish requested a review from a team as a code owner October 19, 2022 21:45
@qiskit-bot
Copy link
Collaborator

Thank you for opening a new pull request.

Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.

While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.

One or more of the the following people are requested to review this:

  • @Qiskit/terra-core

@mtreinish mtreinish force-pushed the remove-parallel-verify-script branch from 6788250 to 0834b47 Compare October 20, 2022 11:05
@coveralls
Copy link

coveralls commented Oct 20, 2022

Pull Request Test Coverage Report for Build 3372572751

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.001%) to 84.532%

Files with Coverage Reduction New Missed Lines %
qiskit/tools/parallel.py 1 83.08%
Totals Coverage Status
Change from base Build 3372571592: -0.001%
Covered Lines: 62438
Relevant Lines: 73863

💛 - Coveralls

In Qiskit#7658 we disabled multiprocessing as part of unittest runs in CI
because the multiple layers of parallelism (subprocess from stestr,
multiprocessing from qiskit, and multithreading from rust in qiskit)
were triggering a latent bug in python's multiprocessing implementation
that was blocking CI. To counter the lost coverage from disabling
multiprocessing in that PR we added a script verify_parallel_map which
force enabled multiprocessing and validated transpile() run in parallel
executed correctly. However, in Qiskit#8952 we introduced a model for
selectively enabling multiprocessing just for a single test method. This
should allow us to avoid the stochastic failure triggering the deadlock
in python's multiprocessing by overloading parallelism but still test in
isolation that parallel_map() works.

This commit builds on the test class introduced in Qiskit#8952 and adds
identical test cases to what was previously in verify_parallel_map.py to
move that coverage into the unit test suite. Then the
verify_parallel_map script is removed and all callers are updated to
just run unit tests instead of also executing that script.
@mtreinish mtreinish force-pushed the remove-parallel-verify-script branch from 0834b47 to 3067250 Compare October 20, 2022 14:49
@mtreinish mtreinish removed the on hold Can not fix yet label Oct 20, 2022
@mtreinish
Copy link
Member Author

Now that #8952 has merged, I've rebased this and it should be ready for review now.

Copy link
Member

@jakelishman jakelishman left a comment

Choose a reason for hiding this comment

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

As a straightforward move of verify_parallel_map.py into the regular test suite, this looks absolutely fine to me. It's good that it removes a load of complexity from the coverage runs too.

Comment on lines +1841 to +1843
for count in counts:
self.assertTrue(math.isclose(count["0000000000000000"], 500, rel_tol=0.1))
self.assertTrue(math.isclose(count["0111111111111111"], 500, rel_tol=0.1))
Copy link
Member

Choose a reason for hiding this comment

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

For completely random seeding, this would have about a 1/640 failure chance, which would be way too high. It's fine given that we've fixed the seed, though.

@mergify mergify bot merged commit 16c2d31 into Qiskit:main Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: None Do not include in changelog type: qa Issues and PRs that relate to testing and code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants