Fix bug in cached dependency resolution with exact resolvable#365
Merged
Conversation
* Add unit test and patch code to pass unit test
Bug description:
1. Exact resolvable and inexact resolvable
2. First run completes, pushes exact resolvable into cache
3. Second run fails with Unsatisfiable
Reproduce:
$ pex psutil psutil==3.2.1 -o test.pex
$ pex psutil psutil==3.2.1 -o test.pex
Could not satisfy all requirements for psutil:
psutil, psutil==3.2.1
The bug manifest itself in pex-tool#178 because by default --cache-ttl is
set to None. This doesn't change those semantics. The default is still
None, so we simply don't return an exact resolvable found in cache
if the --cache-ttl isn't set. Doing so also fixes another bug where
--cache-ttl is set, there is an exact resolvable found in cache, but
it is expired.
It should be noted that this patch could affect the performance of
default pex runs which specify an exact resolvable but don't set
--cache-ttl.
kwlzn
approved these changes
Mar 6, 2017
Contributor
kwlzn
left a comment
There was a problem hiding this comment.
lgtm! tho I do think it would probably make sense to set a default cache ttl in pex/bin/pex.py to accompany this change. how does 1 hour (3600s) sound?
kwlzn
reviewed
Mar 6, 2017
| if self.__cache_ttl: | ||
| packages = self.filter_packages_by_ttl(packages, self.__cache_ttl) | ||
| iterator = Iterator(fetchers=[Fetcher([self.__cache])]) | ||
| packages = self.filter_packages_by_interpreter( |
Contributor
There was a problem hiding this comment.
should probably kill the packages = [] above btw.
Closed
Contributor
Author
|
Sounds good, removed packages=[] and set default ttl to 3600. |
Contributor
|
@butlern merged. thanks for the PR! |
butlern
added a commit
to butlern/pex
that referenced
this pull request
Jun 30, 2017
…ol#365) * Fix bug in cached dependency resolution with exact resolvable * Add unit test and patch code to pass unit test Bug description: 1. Exact resolvable and inexact resolvable 2. First run completes, pushes exact resolvable into cache 3. Second run fails with Unsatisfiable Reproduce: $ pex psutil psutil==3.2.1 -o test.pex $ pex psutil psutil==3.2.1 -o test.pex Could not satisfy all requirements for psutil: psutil, psutil==3.2.1 The bug manifest itself in pex-tool#178 because by default --cache-ttl is set to None. This doesn't change those semantics. The default is still None, so we simply don't return an exact resolvable found in cache if the --cache-ttl isn't set. Doing so also fixes another bug where --cache-ttl is set, there is an exact resolvable found in cache, but it is expired. It should be noted that this patch could affect the performance of default pex runs which specify an exact resolvable but don't set --cache-ttl. * fixup! Fix bug in cached dependency resolution with exact resolvable * fixup! Fix bug in cached dependency resolution with exact resolvable
This file contains hidden or 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
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.
Bug description:
Reproduce:
$ pex psutil psutil==3.2.1 -o test.pex
$ pex psutil psutil==3.2.1 -o test.pex
Could not satisfy all requirements for psutil:
psutil, psutil==3.2.1
The bug manifest itself in #178 because by default --cache-ttl is
set to None. This doesn't change those semantics. The default is still
None, so we simply don't return an exact resolvable found in cache
if the --cache-ttl isn't set. Doing so also fixes another bug where
--cache-ttl is set, there is an exact resolvable found in cache, but
it is expired.
It should be noted that this patch could affect the performance of
default pex runs which specify an exact resolvable but don't set
--cache-ttl.
@kwlzn this should fix #178 now, however, it changes the previous behavior by not returning an exact resolvable found in cache which might affect default performance. I was a little hesitant to set a default for --cache-ttl. Let me know if you think I should do that.