在文档站点上,Pants在第一个概念中提到,它支持分布式缓存的概念来缓存已发布的工件。参见https://pantsbuild.github.io/first_concepts.html。
我一直在文档中查找设置分布式缓存的步骤,但都没有成功。谁能给我指个正确的方向,告诉我该怎么做?
发布于 2015-09-03 07:05:55
首先看看这是否有帮助:https://pantsbuild.github.io/setup_repo.html#outside-caches并返回报告。
发布于 2016-05-01 20:45:49
首先,您希望设置您的裤子,以便将“好的”值写入缓存。pants.ini不会将增量构建的结果上传到缓存,因此我们通常建议您将CI环境设置为发布到缓存,然后设置这些Pants设置以防止zinc在CI中执行增量构建。
[compile.zinc]
# We don't want to use incremental compile in CI. This should short-circuit
# some extra work Pants does to support incremental compile.
incremental: False
# Introduce some randomness when choosing the next chunk of work in order
# to share more work between different CI jobs.
size_estimator: random有两种常用的设置: REST缓存和NFS缓存
如果所有机器都能够访问一个通用的NFS服务器,那么使用NFS会很方便。CI工作进程的配置非常简单:
[cache]
read_from: ["/mnt/nfs/shared-cache/pants-artifact-cache"]
read: True
write_to: ["/mnt/nfs/shared-cache/pants-artifact-cache"]
# For CI builds, turn on writing, but for developer workstations you may
# want to leave this off and mount the NFS dir read-only
write: True
# Turn off auto-purging of the buildcache, leave that to a cron job
max_entries_per_target: 0下面是作为cronjob安装的清理作业:
echo /usr/sbin/tmpwatch -c 14d /data2/shared-cache/pants-artifact-cache > /etc/cron.daily/pants-cache-clean
chmod +x /etc/cron.daily/pants-cache-clean如果您想要设置一个使用REST共享的缓存,您可以配置一个服务器来接受PUT和DELETE调用。然后使用URL配置缓存设置,如下所示:
[cache]
read_from: ["https://pantscache.example.com/pants-artifact-cache/ro"]
read: True
write_to: ["https://pantscache.example.com/pants-artifact-cache/rw"]
# For CI builds, turn on writing, but for developer workstations you may
# want to leave this off.
write: True 请参阅此writeup,了解如何使用Pants设置基本的NGINX。如果你想了解更复杂的缓存设置的详细信息,可以在pants-devel@ group或pantsbuild #general slack组上询问,使用Varnish或多个NGINX服务器进行分片。
https://stackoverflow.com/questions/32364442
复制相似问题