【问题标题】:Rerun rule if Rust project was updated如果 Rust 项目已更新,则重新运行规则
【发布时间】:2020-08-07 16:17:31
【问题描述】:

我有一个 Snakemake 工作流程,其中包含执行一些 Rust 代码的规则。

我知道要在更新 Rust 代码时重新运行该规则,我必须指定所有 Rust 源作为输入。我的目录布局如下:

Snakefile
|- implementation // subfolder containing a Rust workspace.
   |- Cargo.toml
   |- crateA
      |- Cargo.toml
      |- src // directory tree containing *.rs files
   |- crateB
      |- Cargo.toml
      |- src // directory tree containing *.rs files
   |- crateC
      |- Cargo.toml
      |- src // directory tree containing *.rs files

当工作区中的任何源文件或 Cargo.toml 发生更改时,我想重新运行规则。 有没有一些标准的方法可以做到这一点?

如果没有,我如何自动列出所有 Rust 源文件Cargo.tomls 作为 Snakemake 规则的输入?

【问题讨论】:

    标签: rust snakemake


    【解决方案1】:

    我想您可以将所有源文件和 toml 文件收集到一个列表中,并将该列表传递给需要它的规则。例如

    import pathlib
    
    toml_input = pathlib.Path('implementation').glob('**/*.toml')
    
    rule one:
        input:
            toml_input,
        ...
    

    您希望如何收集这些文件当然取决于您...

    【讨论】:

      猜你喜欢
      • 2021-03-19
      • 1970-01-01
      • 1970-01-01
      • 2015-01-18
      • 2022-08-06
      • 2017-01-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多