-
-
Notifications
You must be signed in to change notification settings - Fork 652
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Two targets can swap positions with pantsd (again) (#7642)
Re-landing #7617 without slowing down the happy path of no cycles. Before this PR, nothing would remove the edges of a dirty node, so if two nodes swapped positions in the graph (e.g. if a dependency between two targets inverted), a cycle would be detected. With this PR, if we detect a cycle, but detect that there may be dirty edges in play, we fully clear that node (including removing its edges), which will cause it being re-triggered from scratch. This is specifically in place to handle the cycle scenario - the dirty bit, and dependency Generations are still the primary mechanism for handling re-use of old versions. There's an ugliness here that we still don't remove obsolete edges, so if Generation 2 of a node has differing dependencies from Generation 1, the dependency from Generation 1 will still dirty Generation 2. We _may_ want to consider solving that separately as/when it becomes a significant issue, or we may want to re-work this PR to do something like that... This PR happens to cover a part of that problem, but only where it causes definitive problems (a fake cycle) rather than also where it causes performance problems. There's probably a slightly more principled solution here along the lines of: * Rather than using () as an edge weight in the graph, use the Generation of the dependee Node as an edge weight. * When doing cycle detection, compare the edge weight against the generation of the node, and ignore obsolete edges. but I would want to think about that a lot more before doing it... This re-landing optimises for the no cycle case, which is very strongly expected to be the common case in Pants, as cycles represent errors.
- Loading branch information
1 parent
7ca3089
commit c823939
Showing
3 changed files
with
386 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.