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

Run more tests in parallel #17185

Merged
merged 2 commits into from
May 1, 2024
Merged

Run more tests in parallel #17185

merged 2 commits into from
May 1, 2024

Conversation

hauntsaninja
Copy link
Collaborator

@hauntsaninja hauntsaninja changed the title [mypy] run more tests in parallel Run more tests in parallel Apr 28, 2024

This comment has been minimized.

@manmartgarc
Copy link

Couldn't we use -n auto? Here is a GitHub action using that and using 4 workers. https://github.com/manmartgarc/stochatreat/actions/runs/8866655781/job/24344339586

@hauntsaninja
Copy link
Collaborator Author

I'm not sure of the history here / I'm not sure what the exact specs of the machines underlying Github runners are.

But reading the xdist code: https://github.com/pytest-dev/pytest-xdist/blob/master/src/xdist/plugin.py#L32
If you have psutil installed in your env (which mypy does), psutil.cpu_count() will give you the incorrect value in containerised environments. We'd want the sched_getaffinity number or len(psutil.Process().cpu_affinity()). (It is of course also possible that Github is actually running these on 4 core machines, in which case the numbers would be the same)

@manmartgarc
Copy link

Seems like it's 4; and using -n auto runs 4 workers with pytest-xdist. I just think it might be nice not to have to change this again in the future manually; would approve if I could 😄 .

Copy link
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@JukkaL
Copy link
Collaborator

JukkaL commented Apr 29, 2024

Faster CI sounds great! What's the impact on the various checks we run?

@manmartgarc
Copy link

Faster CI sounds great! What's the impact on the various checks we run?

Latest one in main here, latest one from this PR here.

Seems like 2h 23m 57s to 2h 1m 12s ~15% percent change decrease 🐎

Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

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

The improvements look good, and in line with what I'd expect, if the underlying hardware can run 2 threads per core.

@JukkaL JukkaL merged commit fb31409 into python:master May 1, 2024
18 checks passed
@hauntsaninja hauntsaninja deleted the mypy-mawr branch May 1, 2024 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants