-
-
Notifications
You must be signed in to change notification settings - Fork 652
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
Two targets can swap positions with pantsd (#7583) #7617
Merged
illicitonion
merged 1 commit into
pantsbuild:master
from
twitter:dwagnerhall/pantsd-cycle2
Apr 24, 2019
Merged
Two targets can swap positions with pantsd (#7583) #7617
illicitonion
merged 1 commit into
pantsbuild:master
from
twitter:dwagnerhall/pantsd-cycle2
Apr 24, 2019
Conversation
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
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...
stuhood
approved these changes
Apr 24, 2019
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!
cosmicexplorer
added a commit
to cosmicexplorer/pants
that referenced
this pull request
Apr 29, 2019
…antsbuild#7617)" This reverts commit 5de9012.
cosmicexplorer
added a commit
that referenced
this pull request
Apr 29, 2019
illicitonion
added a commit
that referenced
this pull request
Apr 30, 2019
This reverts commit 5de9012.
illicitonion
added a commit
that referenced
this pull request
Apr 30, 2019
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
Generation of the dependee Node as an edge weight.
generation of the node, and ignore obsolete edges.
but I would want to think about that a lot more before doing it...