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

Optional dependency test VERY slow #22743

Open
oscargus opened this issue Dec 22, 2021 · 4 comments
Open

Optional dependency test VERY slow #22743

oscargus opened this issue Dec 22, 2021 · 4 comments

Comments

@oscargus
Copy link
Contributor

From a recent PR, optional dependencies

sympy/stats/tests/test_continuous_rv.py::test_uniform_P - Took 1796.416 seconds

For the standard test in same PR it is still slow, but much, much faster:

sympy/stats/tests/test_continuous_rv.py::test_uniform_P - Took 12.422 seconds

From a PR from end of October (optional dependencies):

sympy/stats/tests/test_continuous_rv.py::test_uniform_P - Took 1075.193 seconds
5694

which may be within "randomness", but still...

A PR last tested in August, the whole optional dependencies test took 21 minutes compared to 52 minutes for the current one...

No idea what possibly could cause this to happen, but stats and solve may be involved...

@bjodah
Copy link
Member

bjodah commented Dec 22, 2021

Here's a script which should be able to help in finding the offending merge (at least on Linux which supports SIGALARM, not sure about recent versions of windows...):

#!/bin/bash                                                                                                                                                            
cat <<EOF >timeout.py                                                                                                                                                  
import signal, os, sys                                                                                                                                                      
                                                                                                                                                                       
def handler(signum, frame):                                                                                                                                            
    print('Signal handler called with signal', signum)                                                                                                                 
    raise Exception("Did not finish on time!")                                                                                                                         
                                                                                                                                                                       
signal.signal(signal.SIGALRM, handler)                                                                                                                                 
signal.alarm(20) # time in seconds                                                                                                                                     
                                                                                                                                                                       
import pytest                                                                                                                                                          
try:                                                                                                                                                                   
    sys.exit(pytest.main(["-k", "test_uniform_P", "sympy/stats/tests/test_continuous_rv.py"]))
finally:                                                                                                                                                               
    signal.alarm(0) # Disable the alarm                                                                                                                                
                                                                                                                                                                       
EOF                                                                                                                                                                    
                                                                                                                                                                       
git bisect start --first-parent HEAD sympy-1.9                                                                                                                         
git bisect run python3 timeout.py                                                                                                                                      

EDIT:
I think I messed up, /.../

@bjodah
Copy link
Member

bjodah commented Jan 3, 2022

Fixed the script above (I needed to wrap pytest.main with a sys.exit call).
The first offending (with respect to xfailing fast enough) seems to be: gh-22363

Running the timeout.py script on the merges around the bisected commit:

SLOW 54b5877c12 Merge pull request #22369 from praneethratna/22361_line                                                                                                                                              
SLOW 5e11969fd6 Merge branch 'master' into compatibilityremoval                                                                                                                                                      
SLOW 5868aa1cc6 Merge pull request #22370 from smichr/singletons                                                                                                                                                     
SLOW fb7b2d70e0 Merge pull request #22363 from smichr/limit-handling                                                                                                                                                 
FAST 8e89208a89 Merge branch 'master' into compatibilityremoval                                                                                                                                                       
FAST 0e4bab7356 Merge pull request #22342 from smichr/eimport                                                                                                                                                         

@ThePauliPrinciple
Copy link
Contributor

Perhaps it would be useful to set up a PR with the test added in #22363 removed as well as one with the entire PR removed. That way we know if it is really caused by that PR and if so, if it is the changed code or the added tests.

@oscarbenjamin
Copy link
Contributor

For me this fails under pytest:

$ pytest sympy/stats/tests/test_continuous_rv.py::test_uniform_P
...
/_code/code.py", line 748, in get_exconly
INTERNALERROR>     exlines = excinfo.exconly(tryshort=True).split("\n")
INTERNALERROR>   File "/home/oscar/current/sympy/sympy.git/38venv/lib/python3.8/site-packages/_pytest/_code/code.py", line 567, in exconly
INTERNALERROR>     lines = format_exception_only(self.type, self.value)
INTERNALERROR>   File "/usr/lib/python3.8/traceback.py", line 140, in format_exception_only
INTERNALERROR>     return list(TracebackException(etype, value, None).format_exception_only())
INTERNALERROR>   File "/usr/lib/python3.8/traceback.py", line 493, in __init__
INTERNALERROR>     context = TracebackException(
INTERNALERROR>   File "/usr/lib/python3.8/traceback.py", line 493, in __init__
INTERNALERROR>     context = TracebackException(
INTERNALERROR>   File "/usr/lib/python3.8/traceback.py", line 493, in __init__
INTERNALERROR>     context = TracebackException(
INTERNALERROR>   [Previous line repeated 477 more times]
INTERNALERROR>   File "/usr/lib/python3.8/traceback.py", line 476, in __init__
INTERNALERROR>     _seen.add(id(exc_value))
INTERNALERROR> RecursionError: maximum recursion depth exceeded while calling a Python object

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

No branches or pull requests

4 participants