Implement work-stealing scheduler (#862)

Closes #858
This commit is contained in:
Aleksandr Mezin
2023-01-11 13:38:57 +02:00
committed by GitHub
parent 9b0b5b1495
commit d1dfad3e92
10 changed files with 638 additions and 26 deletions

View File

@@ -8,6 +8,7 @@ from xdist.scheduler import (
LoadScopeScheduling,
LoadFileScheduling,
LoadGroupScheduling,
WorkStealingScheduling,
)
@@ -100,6 +101,7 @@ class DSession:
"loadscope": LoadScopeScheduling,
"loadfile": LoadFileScheduling,
"loadgroup": LoadGroupScheduling,
"worksteal": WorkStealingScheduling,
}
return schedulers[dist](config, log)
@@ -282,6 +284,17 @@ class DSession:
"""
self.sched.mark_test_complete(node, item_index, duration)
def worker_unscheduled(self, node, indices):
"""
Emitted when a node fires the 'unscheduled' event, signalling that
some tests have been removed from the worker's queue and should be
sent to some worker again.
This should happen only in response to 'steal' command, so schedulers
not using 'steal' command don't have to implement it.
"""
self.sched.remove_pending_tests_from_node(node, indices)
def worker_collectreport(self, node, rep):
"""Emitted when a node calls the pytest_collectreport hook.