-
-
Notifications
You must be signed in to change notification settings - Fork 291
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
Fix bug in cached dependency resolution with exact resolvable #365
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.
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! 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?
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( |
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.
should probably kill the packages = []
above btw.
Sounds good, removed packages=[] and set default ttl to 3600. |
@butlern merged. thanks for the PR! |
…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
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.