-
Notifications
You must be signed in to change notification settings - Fork 467
Dynamically assign number of pytest-xdist workers via pytest_xdist_auto_num_workers #1393
Copy link
Copy link
Open
Open
Copy link
Labels
A-spec-toolArea: Specification Tooling—Tools for the Ethereum specification (eg. `src/ethereum_spec_tools/*`)Area: Specification Tooling—Tools for the Ethereum specification (eg. `src/ethereum_spec_tools/*`)C-featCategory: an improvement or new featureCategory: an improvement or new featureE-easyExperience: easy, good for newcomersExperience: easy, good for newcomersP-lowstaleThe Issue/PR has not had any activity for 60 days. PRs will be automatically closed.The Issue/PR has not had any activity for 60 days. PRs will be automatically closed.
Milestone
Metadata
Metadata
Assignees
Labels
A-spec-toolArea: Specification Tooling—Tools for the Ethereum specification (eg. `src/ethereum_spec_tools/*`)Area: Specification Tooling—Tools for the Ethereum specification (eg. `src/ethereum_spec_tools/*`)C-featCategory: an improvement or new featureCategory: an improvement or new featureE-easyExperience: easy, good for newcomersExperience: easy, good for newcomersP-lowstaleThe Issue/PR has not had any activity for 60 days. PRs will be automatically closed.The Issue/PR has not had any activity for 60 days. PRs will be automatically closed.
Type
Fields
Give feedbackNo fields configured for Task.
It should be possible with
pytest_xdist_auto_num_workersto:And come up with a reasonable number of cores.
Originally posted by @SamWilsn in #2120 (comment)
pytest docs: CPU parallelization
Right now pytest uses the
-n autoflag that directs pytest-xdist to use as many processes as the computer running the tests has physical CPU cores, up to the limit set by--maxprocesses. The maximum number of processes is currently set to specific values based on our experience of the CI machine's performance.We could likely increase throughput by switching to the
-n logicalflag which would use the max number of logical CPU cores, however, before we do that we need to dynamically adjust the--maxprocessescap based on the system that is running the tests. To do that, we will have to figure out how to determine the available memory on the system and properly adjust to ensure we don't run out.We should also investigate using the
--dist workstealflag for impact on test times which could handle re-assigning jobs to workers who have completed their test queue more efficiently.