I found I could write like below, it works! But I'm not sure if there's a danger to doing this, can anyone give me some advice?
rule all:
input:
"test2"
rule a:
name: "test",
output:
"test",
shell:
"touch {output} "
rule b:
name: "test2",
input: rules.a.output,
output:
"test2",
shell:
"touch {output} "
log:
Building DAG of jobs...
Using shell: /usr/bin/bash
Provided cores: 16
Rules claiming more threads will be scaled down.
Job stats:
job count
----- -------
all 1
test 1
test2 1
total 3
Select jobs to execute...
Execute 1 jobs...
[Sat Oct 12 14:33:20 2024]
localrule test:
output: test
jobid: 2
reason: Missing output files: test
resources: tmpdir=/tmp
touch test
[Sat Oct 12 14:33:20 2024]
Finished job 2.
1 of 3 steps (33%) done
Select jobs to execute...
Execute 1 jobs...
[Sat Oct 12 14:33:20 2024]
localrule test2:
input: test
output: test2
jobid: 1
reason: Missing output files: test2; Input files updated by another job: test
resources: tmpdir=/tmp
touch test2
[Sat Oct 12 14:33:20 2024]
Finished job 1.
2 of 3 steps (67%) done
Select jobs to execute...
Execute 1 jobs...
[Sat Oct 12 14:33:20 2024]
localrule all:
input: test2
jobid: 0
reason: Input files updated by another job: test2
resources: tmpdir=/tmp
[Sat Oct 12 14:33:20 2024]
Finished job 0.
3 of 3 steps (100%) done
Complete log: .snakemake/log/2024-10-12T143320.208718.snakemake.log