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

Do not spawn more workers than testcases #272

Open
azmeuk opened this issue Jan 29, 2018 · 6 comments
Open

Do not spawn more workers than testcases #272

azmeuk opened this issue Jan 29, 2018 · 6 comments
Labels

Comments

@azmeuk
Copy link
Member

azmeuk commented Jan 29, 2018

I switched from a Core i5 (4 cores) to a Ryzen 7 (16 cores). The time pytest-xdist takes to spawn the workers is consequently greater, but it is expected.

Sometimes I run pytest for just several tests: sometimes 1 test, sometimes 1 file with a few tests. I thought it would save some time if pytest-xdist would only spawn the workers needed.

What do you think?

@RonnyPfannschmidt
Copy link
Member

when xdist starts the workers, it has zero idea how many tests are there, so currently its not implementable

@Krilivye
Copy link

Should the collect phase start before launching the workers?

@nicoddemus
Copy link
Member

I guess it would be possible to launch a single worker, collect the tests, and then based on the number of tests spawn the rest of the workers as needed, but this would probably require quite a bit of refactoring to accomplish.

@RonnyPfannschmidt
Copy link
Member

@Krilivye the master does not run any collection, all collection is on the workers

@azmeuk
Copy link
Member Author

azmeuk commented Jan 29, 2018

Has it been designed willingly like this for technical reasons?

@nicoddemus
Copy link
Member

Yes, because transferring tests and fixtures over the wire (between workers and the master node) is quite difficult/impossible, so every worker collects all tests and the master just schedules which test to run based on their node id (take a look at OVERVIEW for more details).

Some related issues: #270, #271

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

No branches or pull requests

4 participants