我正在使用 conda.lock 文件来安装依赖项。 我想知道是否有办法缓存它。 目前,似乎常规缓存似乎对此不起作用。
嗯...我有一个很重的使用锁文件的运行,并且缓存在 linux 和 osx 上工作:
它在 Windows 上不起作用,虽然这让我感到难过,但也不会让我感到惊讶。
如果您有相关存储库的链接、日志或您可以提供的任何其他信息,而不是“不起作用”会有所帮助!
感谢@bollwyvl的快速回复。
很抱歉之前没有提供更多详细信息。 我正在试验一个玩具仓库,你可以在这里找到最近的日志:
https://github.com/ma-sadeghi/xyztest/runs/1534789528?check_suite_focus=true
据报道,缓存大小约为 0MB。
附注。 我没有在这个 repo 中使用setup-miniconda
,我试图让它与 CI 机器上的内置conda
一起工作。
@bollwyvl
查看您的yml
文件并稍微深入研究setup-miniconda
,结果发现我做错了很多事情。 缓存文件夹( ~/conda_pkgs_dir
)不存在,所以我必须手动创建它,而且我没有将CONDA_PKGS_DIRS
环境变量设置为指向~/conda_pkgs_dir
。 这是最近的迭代:
https://github.com/ma-sadeghi/xyztest/runs/1535236467?check_suite_focus=true
这似乎缓存工作正常,“安装依赖项”步骤现在要快得多。
感谢您的洞察力。
哈扎! 为大家缓存!
请注意,缓存整个文件夹将无法正常工作,因为
缓存包含 tarball 和解压缩的内容......在我们的
发布步骤步骤,我们(尝试)清理其中的一些。
如果没有其他损坏,请随时关闭......尤其是这样
不涉及这个动作。
@bollwyvl抱歉,我知道这完全超出了本 repo 的范围,但我可以问一下,您为优化缓存到底做了什么? 你删除了哪些文件? 解压的内容还是压缩包?
是的,这几乎就是它的大小:
https://github.com/conda-incubator/setup-miniconda/blob/master/src/delete.ts
里面还有一些东西,但相比之下,它是微不足道的东西
比方说,mkl 或 qt 解压。
@bollwyvl快速提问:查看delete.ts
,您似乎正在删除未压缩的文件夹,而不是.tar.bz2
压缩文件。 我可能遗漏了一些东西,但似乎通过这样做,conda 需要执行额外的“解压缩”步骤,而如果.tar.bz2
被删除,则conda
可以简单地重用已经解压缩的文件夹。 我在我的电脑上试过,似乎后者导致安装速度更快。
我认为你也可以运行 conda clean 。 @bollwyvl也许我们可以用它代替delete.ts
,我这样做是因为当时我不知道 conda clean 。
$ conda clean --help
usage: conda clean [-h] [-a] [-i] [-p] [-t] [-f]
[-c TEMPFILES [TEMPFILES ...]] [-d] [--json] [-q] [-v] [-y]
Remove unused packages and caches.
Options:
optional arguments:
-h, --help Show this help message and exit.
Removal Targets:
-a, --all Remove index cache, lock files, unused cache packages,
and tarballs.
-i, --index-cache Remove index cache.
-p, --packages Remove unused packages from writable package caches.
WARNING: This does not check for packages installed
using symlinks back to the package cache.
-t, --tarballs Remove cached package tarballs.
-f, --force-pkgs-dirs
Remove *all* writable package caches. This option is
not included with the --all flag. WARNING: This will
break environments with packages installed using
symlinks back to the package cache.
-c TEMPFILES [TEMPFILES ...], --tempfiles TEMPFILES [TEMPFILES ...]
Remove temporary files that could not be deleted
earlier due to being in-use. Argument is path(s) to
prefix(es) where files should be found and removed.
Output, Prompt, and Flow Control Options:
-d, --dry-run Only display what would have been done.
--json Report all output as json. Suitable for using conda
programmatically.
-q, --quiet Do not display progress bar.
-v, --verbose Can be used multiple times. Once for INFO, twice for
DEBUG, three times for TRACE.
-y, --yes Do not ask for confirmation.
Examples:
conda clean --tarballs