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

Flaky pulse deprecation tests #9837

Closed
jakelishman opened this issue Mar 22, 2023 · 7 comments
Closed

Flaky pulse deprecation tests #9837

jakelishman opened this issue Mar 22, 2023 · 7 comments
Labels
bug Something isn't working

Comments

@jakelishman
Copy link
Member

Environment

  • Qiskit Terra version: main @ eb4c5cb
  • Python version: any
  • Operating system: seen on Windows CI

What is happening?

CI is failing frequently with the following error:


test.python.pulse.test_parameter_manager.TestParameterSetter.test_complex_valued_parameter
------------------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):

      File "D:\a\1\s\test\python\pulse\test_parameter_manager.py", line 348, in test_complex_valued_parameter
    assigned = visitor.visit(test_obj)

      File "C:\hostedtoolcache\windows\Python\3.7.9\x64\lib\unittest\case.py", line 270, in __exit__
    self._raiseFailure("{} not triggered".format(exc_name))

      File "C:\hostedtoolcache\windows\Python\3.7.9\x64\lib\unittest\case.py", line 135, in _raiseFailure
    raise self.test_case.failureException(msg)

    AssertionError: PendingDeprecationWarning not triggered

This appears to be related to #9735.

How can we reproduce the issue?

Flaky CI failures.

What should happen?

No flakiness.

Any suggestions?

@TsafrirA and @nkanazawa1989, please can you look at this urgently - it's effectively blocking all CI on Terra.

@jakelishman jakelishman added the bug Something isn't working label Mar 22, 2023
@TsafrirA
Copy link
Collaborator

@jakelishman
Do you want to revert #9735 while I sort this out? Nothing really depends on it at the moment.

@jakelishman
Copy link
Member Author

Thanks for the quick response! Yeah, if you think it might take a little while to get to the bottom of (it appears to be Windows only, which is usually a recipe for an annoying debugging experience), I can revert it and you'll not need to rush.

@TsafrirA
Copy link
Collaborator

Thanks!

@TsafrirA
Copy link
Collaborator

So, the issue seems to be the caching of format_parameter_value. There are two tests (in this testing unit alone, there are possibly others in other units) which format the value 0.1j, and so if the two tests are ran sufficiently close to one another, the second one will get the cached value, and not reach the warning in format_parameter_value.

I guess different operating systems run the tests in different order, failing the test or passing it according to the number of caches between the different 0.1j values?

I will replace the PR shortly.

@TsafrirA
Copy link
Collaborator

(I don't know how the cache is handled across different threads, maybe some operating systems have both calls to format_parameter_value executed "on the same time" thus avoiding the cache?)

@mtreinish
Copy link
Member

In general the execution order of the tests is not fixed and it will change between runs and they also execute in parallel. We're probably seeing it on windows only primarily as a function of the number of vCPUs in the windows VM that ci jobs run in (which effects the split of tests), but that's not the only possible reason. When adding tests it's best to ensure there is no data dependency between tests to avoid issues like this. There are some tools builtin to stestr to try and work with and debug this such as:

you can pass any of these options to stestr via tox with something like: tox -epy -- --random

@nkanazawa1989
Copy link
Contributor

resolved by #9897

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants