1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] How to prevent rule execution due to missing benchmark file in Snakemake?

Discussão em 'Python' iniciado por Stack, Outubro 25, 2024 às 05:42.

  1. Stack

    Stack Membro Participativo

    I'm using Snakemake version 8.23.2 and encountering unexpected behavior related to benchmark files. I want to prevent rules from being re-executed solely due to missing benchmark files.

    Snakefile


    from datetime import datetime
    NOW = datetime.now().strftime("%Y%m%d-%H%M%S")


    rule all:
    input:
    "test"

    rule test:
    output:
    "test"
    benchmark:
    "benchmark/" + NOW + ".tsv"
    shell:
    """
    sleep 3
    touch {output}
    """


    Unexpected Behavior


    When I run snakemake test, the rule is executed on the first run as expected. However, on subsequent runs, it's triggered again due to the missing benchmark file:

    ❯ snakemake test
    [...]
    [Fri Oct 25 15:22:20 2024]
    localrule test:
    output: test
    jobid: 0
    benchmark: benchmark/20241025-152220.tsv
    reason: Missing output files: benchmark/20241025-152220.tsv
    resources: tmpdir=/tmp
    [...]

    Expected Behavior


    I expect Snakemake to consider the rule up-to-date if the main output file exists, regardless of the benchmark file's presence:

    ❯ snakemake all
    Assuming unrestricted shared filesystem usage.
    Building DAG of jobs...
    Nothing to be done (all requested files are present and up to date).

    What I've Tried


    I've attempted to use the --rerun-triggers option, but it doesn't seem to resolve this issue.

    Use Case


    I often run snakemake $(snakemake --list-target-rules) to trigger all target rules. Some target rules may have already succeeded in previous runs, and I don't want them to re-execute just because of missing benchmark files.

    Is there a way to configure Snakemake to ignore missing benchmark files when determining whether a rule needs to be re-run?

    Continue reading...

Compartilhe esta Página