-
Notifications
You must be signed in to change notification settings - Fork 230
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
LoadScope scheduler: Sort scopes by number of tests to assign biggest scopes first #778
LoadScope scheduler: Sort scopes by number of tests to assign biggest scopes first #778
Conversation
That is exactly what I do in the "more sophisticated" approach I was talking about in the original PR. We sort scopes by previous runtime and then distribute among xdist workers according to this data. But I think it will be hard to get something like this into xdist because it depends a lot on your environment. In an ideal world xdist should provide an official extension mechanism which lets you hook in your own code easily, similar to how pytest itself is extensible. We had to do a huge monkey patch to get this done but the actual custom code is <50 lines. FYI be careful with the CircleCI test splitter, my experience is that it doesn't correctly take timings into account even though it says so. |
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.
Thanks @cryvate and @joekohlsdorf for the contribution. 👍
I will make a new release once this is merged.
113a197
to
7bd858e
Compare
Thanks @nicoddemus! |
…v/pytest-xdist#778, even if at first this appear to be unrelated (we use `loadfile` and not `loadscope`)
…v/pytest-xdist#778, even if at first this appear to be unrelated (we use `loadfile` and not `loadscope`)
…v/pytest-xdist#778, even if at first this appear to be unrelated (we use `loadfile` and not `loadscope`)
…v/pytest-xdist#778, even if at first this appear to be unrelated (we use `loadfile` and not `loadscope`)
Based upon this PR/branch, OP text quoted here:
I have one reservation about this change and backwards compatibility when we have
test_a.py
andtest_b.py
:test_b.py
is run before any tests fromtest_a.py
in any runnertest_b.py
might run before any tests fromtest_a.py
in a runner (iftest_b.py
contains more tests)I don't know what the general
pytest
(-plugin)'s view andpytest-xdist
's view in particular is on backwards compatibility in the face of, essentially, flaky/broken tests.Long term I wonder whether we would want to expose the ordering of this queue somehow: it would be cool when e.g. running in CircleCI (which can seed based on previous running times) to be able to repeat the same within the runners, especially as they could have many cores/parallel runners and so there can be inefficiencies.