-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Enable memray for tests. #14090
Enable memray for tests. #14090
Conversation
👋 Thank you for your draft pull request! Do you know that you can use |
e148b94
to
1f092cb
Compare
|
||
# NOTE: In the build below we also check that tests do not open and | ||
# leave open any files. This has a performance impact on running the | ||
# tests, hence why it is not enabled by default. | ||
- name: Python 3.9 with all optional dependencies | ||
linux: py39-test-alldeps | ||
toxargs: -v --develop | ||
posargs: --open-files --run-slow | ||
posargs: --open-files --run-slow --memray |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need memray in so many jobs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose not, but if we want to start decorating tests for memray to enforce memory limits (and maybe the leak checks), this will require --memray
to give them actual force.
06e8488
to
1573eb8
Compare
This is what I see in the log:
tl;dr -- I guess it only reports the top 5 offenders or something? This is a lot of info to digest and I am afraid that all this CPU cycles will be wasted if people ignore it most of the time anyway. I wonder if it should be very targeted like the timing benchmarks. But since even that is broken right now, I dunno. But definitely not to be run every push. Maybe when we can agree on what to actually profile, we can move it to a cron job and it can be activated on-demand for PR by a special label. |
@pllim, I agree that the report would be better used as part of the benchmarks and/or as part of a cron. The number of items reported is controllable via the There are two use cases that I can see
Note that if Obviously, there are no such decorators for tests included in this PR as I don't really know where to start with where to place those; however, the main part of this PR is to demonstrate that we can run The other part of this PR was to start getting a baseline for memory usage across astropy (to figure out where to target memory usage/leak tests), which as suggested maybe better suited to a cron job for now. |
I agree we don't need to run it in CI for all tests like this, though there may be some tests where we can decrease the size of the arrays. But i have no idea, what is the overhead with memray ? |
1573eb8
to
0064d2a
Compare
Description
The PR adds the
pytest-memray
plugin which is supposed to help us track memory usage in our test suite. This work is in anticipation of bloomberg/pytest-memray#52, which should allow us to detect some memory leaks inastropy
which would be exposed by our test suite. I think this might be useful considering all the C code used byastropy
.Checklist for package maintainer(s)
This checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.
Extra CI
label. Codestyle issues can be fixed by the bot.no-changelog-entry-needed
label. If this is a manual backport, use theskip-changelog-checks
label unless special changelog handling is necessary.astropy-bot
check might be missing; do not let the green checkmark fool you.backport-X.Y.x
label(s) before merge.