fix: ensure consistent node workload assignment by sorting nodes by gwid#1318
fix: ensure consistent node workload assignment by sorting nodes by gwid#1318ttimonen wants to merge 1 commit intopytest-dev:masterfrom
Conversation
…ateway ID. Fixes the flaky test_workqueue_ordered_by_size test.
RonnyPfannschmidt
left a comment
There was a problem hiding this comment.
That one is interesting
Ordered at that particular place shouldn't be necessary
We may have a timing issue in worker startup
Let me try to expand on what I think happens here, based on my understanding.
from xdist’s perspective: Now the interesting part is probably on the event processing in the workerready -side. So in b the add_node adds the nodes to the assigned_work dictionary in arbitrary order. While python dicts are all ordered nowadays, the insertion order varies here. I.e. add_node calls come from the DSession’s event queue, and the two gw remotes are competing in which one will submit the “workerready” event first (irrespective of the order they were started). So add_node(gw0) and add_node(gw1) will be called in arbitrary order.
To make output deterministic, we could either synthesize the gw identity based on their order of becoming ready (might have other side-effects though), assign work on name-order (which is done with this patch and seems like the least amount of friction), or do something else (like hide the id from output, since it’s semantically irrelevant (yet part of the implicit API now), or make the test ignore the gw id; bit ambiguous what the test would be testing in that case though). |
|
A minimal example to reproduce the problem and the effectiveness of the fix: Now replace the default pytest-xdist from current branch with PYTHONPATH=../src |
Fixes the flaky test_workqueue_ordered_by_size test (#985 and #1248 )
Here's a quick checklist that should be present in PRs:
changelogfolder.