-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Implement "lazy sequence" to avoid Internet access during candidate search #8932
Conversation
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.
You didn't mention you were implementing this! :o (to be fair, neither did I)
A few minor comments inline.
I quite like the sound of this. OTOH, it should be possible to do it make this change here now and have resolvelib add this support in a backwards-compatible way after-the-fact, based on feedback on this variant -- we could then flip the switch on this side after that. :) |
I was trying to do this in resolvelib initially, but found that the implementation needs to change quite a bit for it to work. The boolean check (i.e. whether the list is empty) is currently used to drive backtracking (if it’s empty, we’re hitting a dead end and should backtrack), and switching to an iterator means the resolver needs to change how it backtracks. I think it’s probably a better plan to include this in pip for a while, to avoid resolvelib blocking pip releases. |
70731ea
to
16ea298
Compare
This plus the caching PR gets us to
The rest is probably due to the extra checks and not avoidable. For context, the new resolver emits 371 “Requirement already satisfied” messages; the older resolver only 163. These should correspond quite directly to how much computation each resolver does. |
Uh, why is Travis reporting legistimate test errors while Azure claims everything is fine 😞 |
Don't we only run the new resolver tests on Travis CI? |
I'mma add this to 20.3 as a release blocker, since I strongly believe that we should include this change in the main rollout release. Please holler if you disagree. :) |
Oh, I misred and thought the failures are from |
That should do it. |
b32ff85
to
9b21352
Compare
I was trying to address the upgrade strategy issue mentioned above, and ended up re-implementing all the iterator stuff. I actually feel this is much better than the previous class-based approach though, both shorter and easier to understand. |
b22045a
to
c689b93
Compare
@pradyunsg and I discussed this pull request in today's meeting. To make enough progress on #8664, we either need to merge this into pip, or we need to merge sarugaku/resolvelib#57 into resolvelib, then cut a resolvelib release, update the vendored version in pip, and update pip's implementation. Pradyun will talk with @uranusjr to figure out the best path forward. |
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.
LGTM
@uranusjr @pradyunsg there's conflicts |
find_matches() is modified to return a special type that implements the sequence protocol (instead of a plain list). This special sequence type tries to use the installed candidate as the first element if possible, and only access indexes when the installed candidate is considered unsatisfactory.
c689b93
to
a279a9c
Compare
a279a9c
to
b921db8
Compare
find_matches()
is modified to return a special type that implements the sequence protocol (instead of a plain list). This special sequence type tries to use the installed candidate as the first element if possible, and only access indexes when the installed candidate is considered unsatisfactory.Outdated numbers
Using the reprod from #8664 (comment):
I kind of feel the lazy sequence implementation should be pushed into resolvelib instead. The
find_matches()
would be modified to return aCallable[[], Optional[Iterator[Candidate]]]
instead. This callable would be called multiple times by the resolver (to replace the need of iterating through the sequence multiple times in the current implementation).Fix #8023.