如何忽略 Snakemake 中更改的代码

问题描述 投票:0回答:3

我正在使用 Snakemake 7.3.8。

我收到消息说:

块引用 用于生成一个或多个输出文件的代码已更改: 要检查哪些输出文件发生了更改,请运行“snakemake --list-code-changes”。 要触发重新运行,请使用“snakemake -R $(snakemake --list-code-changes)”。

我认为这是因为控制文件(snakefile)已被修改并且与代码的缓存副本不同(我将其定位在 .snakemake/metadata 中)。

假设我确信代码中的更改无关紧要并且我可以继续。有没有办法告诉 Snakemake 忽略代码中的这些特定更改而不重新运行?

python snakemake
3个回答
2
投票

你可以运行:

snakemake -R $(snakemake --list-code-changes) --touch

触摸选项:

--touch, -t           Touch output files (mark them up to date without really
changing them) instead of running their commands. This is used to pretend
that the rules were executed, in order to fool future invocations of
snakemake. Fails if a file does not yet exist. Note that this will only touch
files that would otherwise be recreated by Snakemake (e.g. because their
input files are newer). For enforcing a touch, combine this with --force,
--forceall, or --forcerun. Note however that you loose the provenance
information when the files have been created in realitiy. Hence, this should
be used only as a last resort. (default: False)

0
投票

是的,您可以通过传递特定的

--rerun-triggers
来忽略代码更改,例如

snakemake --rerun-triggers mtime

从而覆盖默认值,即以下所有内容,特别是默认值包括代码更改。

来自文档:

--rerun-triggers

可能的选择:

mtime
params
input
software-env
code

定义触发作业重新运行的因素。默认情况下,使用所有触发器,这保证结果与工作流代码和配置一致。如果您更喜欢仅考虑文件修改日期的传统方式,请使用

-–rerun-trigger mtime

默认:[‘mtime’、‘params’、‘input’、‘software-env’、‘code’]

参见https://snakemake.readthedocs.io/en/stable/executing/cli.html#execution


0
投票

这对我有用:

snakemake -j 1 --list-code-changes | xargs -i -P 20 snakemake {} --cm

尽管它有潜在的危险,因为它会删除文件上的元数据。

© www.soinside.com 2019 - 2024. All rights reserved.