Skip to content

--delete-all-output ignores --dry-run #3264

@GaspardR

Description

@GaspardR

Snakemake version
8.27.1

Describe the bug
Running --delete-all-output with --dry-run ignores dry-run, it deletes all output files.

Logs

Minimal example
Snakefile:

rule all:
    input:
        expand("results/{name}.txt", name=range(2))

rule A:
    output:
        "results/{name}.txt"
    shell:
        "touch {output}"

Command-line:

$ snakemake -c1
Assuming unrestricted shared filesystem usage.
host: bif02.ircm.priv
Building DAG of jobs...
Using shell: /usr/bin/bash
Provided cores: 1 (use --cores to define parallelism)
Rules claiming more threads will be scaled down.
Job stats:
job      count
-----  -------
A            2
all          1
total        3

Select jobs to execute...
Execute 1 jobs...

[Wed Jan 22 14:53:35 2025]
localrule A:
    output: results/0.txt
    jobid: 1
    reason: Missing output files: results/0.txt
    wildcards: name=0
    resources: tmpdir=/tmp

[Wed Jan 22 14:53:35 2025]
Finished job 1.
1 of 3 steps (33%) done
Select jobs to execute...
Execute 1 jobs...

[Wed Jan 22 14:53:35 2025]
localrule A:
    output: results/1.txt
    jobid: 2
    reason: Missing output files: results/1.txt
    wildcards: name=1
    resources: tmpdir=/tmp

[Wed Jan 22 14:53:35 2025]
Finished job 2.
2 of 3 steps (67%) done
Select jobs to execute...
Execute 1 jobs...

[Wed Jan 22 14:53:35 2025]
localrule all:
    input: results/0.txt, results/1.txt
    jobid: 0
    reason: Input files updated by another job: results/1.txt, results/0.txt
    resources: tmpdir=/tmp

[Wed Jan 22 14:53:35 2025]
Finished job 0.
3 of 3 steps (100%) done
Complete log: .snakemake/log/2025-01-22T145335.409725.snakemake.log

Dry-run delete all output:

$ snakemake -c1 --dry-run --delete-all-output
Building DAG of jobs...
Deleting results/0.txt
Deleting results/1.txt

All files have been deleted instead of listing the files that would be deleted.

Additional context
The issue comes from:
cli.py lines 2151-2154

We can see that just adding dag_api.delete_output(dryrun=args.dryrun) like in delete_temp_output should fix the issue. I can open a PR with a fix if you would like.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions