-
Notifications
You must be signed in to change notification settings - Fork 232
Restore old initial batch distribution logic in LoadScheduling #812
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Partially restore old initial batch distribution algorithm in ``LoadScheduling``. | ||
|
||
pytest orders tests for optimal sequential execution - i. e. avoiding | ||
unnecessary setup and teardown of fixtures. So executing tests in consecutive | ||
chunks is important for optimal performance. | ||
|
||
In v1.14, initial test distribution in ``LoadScheduling`` was changed to | ||
round-robin, optimized for the corner case, when the number of tests is less | ||
than ``2 * number of nodes``. At the same time, it became worse for all other | ||
cases. | ||
|
||
For example: if some tests use some "heavy" fixture, and these tests fit into | ||
the initial batch, with round-robin distribution the fixture will be created | ||
``min(n_tests, n_workers)`` times, no matter how many other tests there are. | ||
|
||
With the old algorithm (before v1.14), if there are enough tests not using | ||
the fixture, the fixture was created only once. | ||
|
||
So restore the old behavior for typical cases where the number of tests is | ||
much greater than the number of workers (or, strictly speaking, when there | ||
are at least 2 tests for every node). | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,18 +115,18 @@ def test_schedule_batch_size(self, pytester: pytest.Pytester) -> None: | |
# assert not sched.tests_finished | ||
sent1 = node1.sent | ||
sent2 = node2.sent | ||
assert sent1 == [0, 2] | ||
assert sent2 == [1, 3] | ||
assert sent1 == [0, 1] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test was updated to match the new distribution method, could you please add a new test which checks that we are using round robin for smaller collections? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is already such test, called |
||
assert sent2 == [2, 3] | ||
assert sched.pending == [4, 5] | ||
assert sched.node2pending[node1] == sent1 | ||
assert sched.node2pending[node2] == sent2 | ||
assert len(sched.pending) == 2 | ||
sched.mark_test_complete(node1, 0) | ||
assert node1.sent == [0, 2, 4] | ||
assert node1.sent == [0, 1, 4] | ||
assert sched.pending == [5] | ||
assert node2.sent == [1, 3] | ||
sched.mark_test_complete(node1, 2) | ||
assert node1.sent == [0, 2, 4, 5] | ||
assert node2.sent == [2, 3] | ||
sched.mark_test_complete(node1, 1) | ||
assert node1.sent == [0, 1, 4, 5] | ||
assert not sched.pending | ||
|
||
def test_schedule_fewer_tests_than_nodes(self, pytester: pytest.Pytester) -> None: | ||
|
Uh oh!
There was an error while loading. Please reload this page.