-
-
Notifications
You must be signed in to change notification settings - Fork 288
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
Retain and index downloads when locking. #1650
Retain and index downloads when locking. #1650
Conversation
For the local case of lock create and then later resolve, it will be good to retain the (primary) artifacts downloaded for the local interpreter when creating the lock used to lock in order to save downloading those artifacts again when later resolving from the lock. Work towards pex-tool#1583.
return str(fp.read().decode("ascii")) | ||
|
||
|
||
class DownloadManager(object): |
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.
N.B.: The forthcoming lock resolver will have its own implementation of this; thus factoring up the logic of where to store downloads for re-use / cache-hits centrally here.
# type: (Artifact) -> DownloadedArtifact | ||
|
||
download_dir = os.path.join(self._download_dir, artifact.fingerprint.hash) | ||
with atomic_directory(download_dir, exclusive=True) as atomic_dir: |
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.
There is actually no need for this to be exclusive in this PR; however the lock resolver will also be implementing this and fetching URLs directly from PyPI most of the time. The exclusive lock will prevent two independent processes from trying to download the same artifact from PyPI concurrently and relieve a little pressure from PyPI as a result.
For the local case of lock create and then later resolve, it will be
good to retain the (primary) artifacts downloaded by Pip for the local
interpreter when creating the lock in order to save downloading those
artifacts again when later resolving from the lock.
Work towards #1583.