-
Notifications
You must be signed in to change notification settings - Fork 377
configuration section and download cache docs #1544
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
Merged
memsharded
merged 14 commits into
conan-io:develop
from
memsharded:feature/configuration_download_cache
Feb 4, 2020
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
f34d020
configuration section and download cache docs
memsharded 51d5a98
Update configuration/download_cache.rst
memsharded 52566db
Update configuration/download_cache.rst
memsharded e88559f
Update configuration/download_cache.rst
memsharded a100f94
Update configuration/download_cache.rst
memsharded cbf4d1a
Update configuration/download_cache.rst
memsharded 7b085e1
Update configuration/download_cache.rst
memsharded f4e50de
Update configuration/download_cache.rst
memsharded 3e0e14d
Update configuration/download_cache.rst
memsharded 2520856
review
memsharded b829a71
Update configuration/download_cache.rst
memsharded b1369d6
Update configuration/download_cache.rst
memsharded 33a9d12
Merge branch 'develop' into feature/configuration_download_cache
memsharded f2f300e
review 2
memsharded File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.. _configuration: | ||
|
||
Configuration | ||
--------------- | ||
|
||
The Conan client can be configured to behave differently. Most of the configuration can be found in the :ref:`conan.conf reference <conan_conf>`, | ||
but this section aims to be an introduction to the configuration based on different use cases. | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
configuration/download_cache |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
.. _download_cache: | ||
|
||
Download cache | ||
============== | ||
|
||
.. warning:: | ||
|
||
This is an **experimental** feature subject to breaking changes in future releases. | ||
|
||
.. warning:: | ||
|
||
This is an **advanced** feature, use it only if you fully understand this document. Do not use it if you are mixing api V1 (without revisions) | ||
and api V2 (with revisions) clients. | ||
|
||
|
||
|
||
Conan implements a shared download cache that can be used to reduce the time needed to populate the Conan package cache | ||
with commands like :command:`install`, :command:`create`. | ||
|
||
This cache is purely an optimization mechanism. It is completely different to the :ref:`Conan package cache <custom_cache>`, (typically the ``<userhome>/.conan`` folder). | ||
It is not related to the ``short_paths`` mechanism for long path in Windows, nor to the ``short_paths`` cache folder. The cache will contain a copy | ||
of the artifacts, it is not a new location of files. Those files will still be copied to the Conan package cache, which will not change anything, | ||
its behavior, layout or location of any file. | ||
|
||
This cache (whose path can be configured in the *conan.conf* file) will store the following items: | ||
|
||
- All files that are downloaded from a Conan server (conan_server, Artifactory), both in the api V1 (without revisions) and V2 (with revisions). | ||
This includes files like *conanfile.py*, but also the zipped artifacts like *conan_package.tgz* or *conan_sources.tgz*. | ||
- The downloads done by users with the ``tools.download()`` or ``tools.get()`` helpers, as long as they provide a checksum (md5, sha1, etc.). If | ||
a checksum is not provided, even if the download cache is enabled, the download will be always executed and the files will not be cached. | ||
|
||
The cache computes a sha256 checksum of the download URL and the file checksum whenever is available. | ||
|
||
.. warning:: | ||
|
||
As not always the file checksums are available, the download cache will not be able to correctly cache artifacts with revisions enabled | ||
if those artifacts are created and uploaded repeatedly in a client without revisions, because that will keep overwriting the revision "0". | ||
Similarly, the download cache will fail if a proxy suddenly and transparently changes a existing server and moves it to a new location, | ||
without the clients changing the URL too. | ||
|
||
|
||
Activating/deactivating the download cache | ||
------------------------------------------ | ||
|
||
The download cache is activated and configured in the :ref:`conan_conf` like this: | ||
|
||
.. code-block:: text | ||
|
||
[storage] | ||
download_cache=/path/to/my/cache | ||
|
||
It can be defined from the command line: | ||
|
||
.. code-block:: bash | ||
|
||
$ conan config set storage.download_cache="/path/to/my/cache" | ||
# Display it | ||
$ conan config get storage.download_cache | ||
|
||
|
||
And, as the *conan.conf* is part of the configuration, you can also put a common *conan.conf* file in a git repo or zip file and use | ||
the :ref:`conan_config_install` command to automatically install it in Conan clients. | ||
memsharded marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
To deactivate the download cache, you can remove the entry ``download_cache`` from the *conan.conf* with the command: | ||
|
||
.. code-block:: bash | ||
|
||
$ conan config rm storage.download_cache | ||
|
||
|
||
Concurrency, multiple caches and CI | ||
----------------------------------- | ||
|
||
The downloads cache implements exclusive locks for concurrency, so it can be shared among different concurrent Conan instances. | ||
This is a typical scenario in CI servers, in which each job uses a different Conan package cache (defined by ``CONAN_USER_HOME`` environment | ||
variable). Every different Conan instance could configure its download cache to share the same storage. The download cache implements interprocess | ||
exclusive locks, so only 1 process will access at a time to a given cached artifact. If other processes needs the same artifact, they will wait | ||
until it is released, avoiding multiple downloads of the same file, even if they were requested almost simultaneously. | ||
|
||
For Continuous Integration processes, it is recommended to have a different Conan package cache (``CONAN_USER_HOME``) for each job, in most of the cases, | ||
because the Conan package cache is not concurrent, and it might also have old dependencies, stale packages, etc. It is better to run CI jobs in a clean | ||
environment. | ||
memsharded marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
Removing cached files | ||
--------------------- | ||
|
||
The download cache will store a lot of artifacts, for all recipes, packages, versions and configurations that are used. This can grow and consume | ||
a lot of storage. If you are using this feature, provide for a sufficiently large and fast download cache folder. | ||
|
||
At the moment, it is only a folder. You can clean the cached artifacts just by removing that folder and its contents. You might also be able to | ||
run scripts and jobs that remove old artifacts only. If you do such operations, please make sure that there are not other Conan processes using | ||
it simultaneously, or they might fail. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ Contents: | |
systems_cross_building | ||
extending | ||
integrations | ||
configuration | ||
howtos | ||
reference | ||
videos | ||
|
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
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.
Uh oh!
There was an error while loading. Please reload this page.