Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix false reruns after checkpoints (#1907)
fixes issue #1818 ### Description <!--Add a description of your PR here--> ### QC <!-- Make sure that you can tick the boxes below. --> * [x] The PR contains a test case for the changes or the changes are already covered by an existing test case. * [x] The documentation (`docs/`) is updated to reflect the changes or this is not necessary (e.g. if the change does neither modify the language nor the behavior or functionalities of Snakemake).
- Loading branch information
1 parent
a067a1b
commit dc5af12
Showing
21 changed files
with
83 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
tests/test_github_issue1818/.snakemake/metadata/YWdncmVnYXRlZC50eHQ=
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"version": null, "code": "gASVpQEAAAAAAAAoQxJ0AGQBfA58EWQCjQMBAGQAUwCUKIwFaW5wdXSUjAZvdXRwdXSUjAZwYXJhbXOUjAl3aWxkY2FyZHOUjAd0aHJlYWRzlIwJcmVzb3VyY2VzlIwDbG9nlIwHdmVyc2lvbpSMBHJ1bGWUjAljb25kYV9lbnaUjA1jb250YWluZXJfaW1nlIwQc2luZ3VsYXJpdHlfYXJnc5SMD3VzZV9zaW5ndWxhcml0eZSMC2Vudl9tb2R1bGVzlIwMYmVuY2hfcmVjb3JklIwFam9iaWSUjAhpc19zaGVsbJSMD2JlbmNoX2l0ZXJhdGlvbpSMD2NsZWFudXBfc2NyaXB0c5SMCnNoYWRvd19kaXKUjA1lZGl0X25vdGVib29rlIwPY29uZGFfYmFzZV9wYXRolIwHYmFzZWRpcpSMGHJ1bnRpbWVfc291cmNlY2FjaGVfcGF0aJSMGF9faXNfc25ha2VtYWtlX3J1bGVfZnVuY5R0lF2UKE6MGmVjaG8gQUdHUkVHQVRFRCA+IHtvdXRwdXR9lGgPaBKGlGWMBXNoZWxslIWUdJQu", "rule": "aggregate", "input": ["my_directory/1.txt", "my_directory/2.txt", "my_directory/3.txt"], "log": [], "params": [], "shellcmd": "echo AGGREGATED > aggregated.txt", "incomplete": false, "starttime": 1665672954.609385, "endtime": 1665672954.619385, "job_hash": 8729438519112, "conda_env": null, "container_img_url": null, "input_checksums": {"my_directory/1.txt": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "my_directory/2.txt": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "my_directory/3.txt": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"}} |
1 change: 1 addition & 0 deletions
1
tests/test_github_issue1818/.snakemake/metadata/bXlfZGlyZWN0b3J5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"version": null, "code": "gASV9gEAAAAAAAAoQxJ0AGQBfA58EWQCjQMBAGQAUwCUKIwFaW5wdXSUjAZvdXRwdXSUjAZwYXJhbXOUjAl3aWxkY2FyZHOUjAd0aHJlYWRzlIwJcmVzb3VyY2VzlIwDbG9nlIwHdmVyc2lvbpSMBHJ1bGWUjAljb25kYV9lbnaUjA1jb250YWluZXJfaW1nlIwQc2luZ3VsYXJpdHlfYXJnc5SMD3VzZV9zaW5ndWxhcml0eZSMC2Vudl9tb2R1bGVzlIwMYmVuY2hfcmVjb3JklIwFam9iaWSUjAhpc19zaGVsbJSMD2JlbmNoX2l0ZXJhdGlvbpSMD2NsZWFudXBfc2NyaXB0c5SMCnNoYWRvd19kaXKUjA1lZGl0X25vdGVib29rlIwPY29uZGFfYmFzZV9wYXRolIwHYmFzZWRpcpSMGHJ1bnRpbWVfc291cmNlY2FjaGVfcGF0aJSMGF9faXNfc25ha2VtYWtlX3J1bGVfZnVuY5R0lF2UKE6MawogICAgICAgIG1rZGlyIG15X2RpcmVjdG9yeS8KICAgICAgICBjZCBteV9kaXJlY3RvcnkKICAgICAgICBmb3IgaSBpbiAxIDIgMzsgZG8gdG91Y2ggJGkudHh0OyBkb25lCiAgICAgICAglGgPaBKGlGWMBXNoZWxslIWUdJQu", "rule": "somestep", "input": [], "log": [], "params": [], "shellcmd": "\n mkdir my_directory/\n cd my_directory\n for i in 1 2 3; do touch $i.txt; done\n ", "incomplete": false, "starttime": 1665672954.5860517, "endtime": 1665672954.6027184, "job_hash": 8729438582497, "conda_env": null, "container_img_url": null, "input_checksums": {}} |
1 change: 1 addition & 0 deletions
1
tests/test_github_issue1818/.snakemake/metadata/cHJvY2Vzc2VkLnR4dA==
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"version": null, "code": "gASVpAEAAAAAAAAoQxJ0AGQBfA58EWQCjQMBAGQAUwCUKIwFaW5wdXSUjAZvdXRwdXSUjAZwYXJhbXOUjAl3aWxkY2FyZHOUjAd0aHJlYWRzlIwJcmVzb3VyY2VzlIwDbG9nlIwHdmVyc2lvbpSMBHJ1bGWUjAljb25kYV9lbnaUjA1jb250YWluZXJfaW1nlIwQc2luZ3VsYXJpdHlfYXJnc5SMD3VzZV9zaW5ndWxhcml0eZSMC2Vudl9tb2R1bGVzlIwMYmVuY2hfcmVjb3JklIwFam9iaWSUjAhpc19zaGVsbJSMD2JlbmNoX2l0ZXJhdGlvbpSMD2NsZWFudXBfc2NyaXB0c5SMCnNoYWRvd19kaXKUjA1lZGl0X25vdGVib29rlIwPY29uZGFfYmFzZV9wYXRolIwHYmFzZWRpcpSMGHJ1bnRpbWVfc291cmNlY2FjaGVfcGF0aJSMGF9faXNfc25ha2VtYWtlX3J1bGVfZnVuY5R0lF2UKE6MGWVjaG8gUFJPQ0VTU0VEID4ge291dHB1dH2UaA9oEoaUZYwFc2hlbGyUhZR0lC4=", "rule": "process", "input": ["aggregated.txt"], "log": [], "params": [], "shellcmd": "echo PROCESSED > processed.txt", "incomplete": false, "starttime": 1665672954.6227183, "endtime": 1665672954.6327186, "job_hash": 8729438582463, "conda_env": null, "container_img_url": null, "input_checksums": {"aggregated.txt": "a144e9df267c10532db93a5e1625d6362d934c9973be60a6c07718a1f1942f12"}} |
1 change: 1 addition & 0 deletions
1
tests/test_github_issue1818/.snakemake/metadata/cHJvY2Vzc2VkMi50eHQ=
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"version": null, "code": "gASVpQEAAAAAAAAoQxJ0AGQBfA58EWQCjQMBAGQAUwCUKIwFaW5wdXSUjAZvdXRwdXSUjAZwYXJhbXOUjAl3aWxkY2FyZHOUjAd0aHJlYWRzlIwJcmVzb3VyY2VzlIwDbG9nlIwHdmVyc2lvbpSMBHJ1bGWUjAljb25kYV9lbnaUjA1jb250YWluZXJfaW1nlIwQc2luZ3VsYXJpdHlfYXJnc5SMD3VzZV9zaW5ndWxhcml0eZSMC2Vudl9tb2R1bGVzlIwMYmVuY2hfcmVjb3JklIwFam9iaWSUjAhpc19zaGVsbJSMD2JlbmNoX2l0ZXJhdGlvbpSMD2NsZWFudXBfc2NyaXB0c5SMCnNoYWRvd19kaXKUjA1lZGl0X25vdGVib29rlIwPY29uZGFfYmFzZV9wYXRolIwHYmFzZWRpcpSMGHJ1bnRpbWVfc291cmNlY2FjaGVfcGF0aJSMGF9faXNfc25ha2VtYWtlX3J1bGVfZnVuY5R0lF2UKE6MGmVjaG8gUFJPQ0VTU0VEMiA+IHtvdXRwdXR9lGgPaBKGlGWMBXNoZWxslIWUdJQu", "rule": "process2", "input": ["processed.txt"], "log": [], "params": [], "shellcmd": "echo PROCESSED2 > processed2.txt", "incomplete": false, "starttime": 1665672954.636052, "endtime": 1665672954.6493852, "job_hash": 8729438582446, "conda_env": null, "container_img_url": null, "input_checksums": {"processed.txt": "49f193a0dae7bdb2368a9f113cf2e1f3827a787dde3808a5d7838bc8ff63164c"}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# a target rule to define the desired final output | ||
rule all: | ||
input: | ||
"processed2.txt", | ||
|
||
|
||
# the checkpoint that shall trigger re-evaluation of the DAG | ||
# an number of file is created in a defined directory | ||
checkpoint somestep: | ||
output: | ||
directory("my_directory/"), | ||
shell: | ||
""" | ||
mkdir my_directory/ | ||
cd my_directory | ||
for i in 1 2 3; do touch $i.txt; done | ||
""" | ||
|
||
|
||
# input function for rule aggregate, return paths to all files produced by the checkpoint 'somestep' | ||
def aggregate_input(wildcards): | ||
checkpoint_output = checkpoints.somestep.get(**wildcards).output[0] | ||
return expand( | ||
"my_directory/{i}.txt", | ||
i=glob_wildcards(os.path.join(checkpoint_output, "{i}.txt")).i, | ||
) | ||
|
||
|
||
rule aggregate: | ||
input: | ||
aggregate_input, | ||
output: | ||
"aggregated.txt", | ||
shell: | ||
"echo AGGREGATED > {output}" | ||
|
||
|
||
# Fail here if the job runs again, as we want to ensure that snakemake does not false trigger a rerun | ||
# as reported in issue #1818. | ||
rule process: | ||
input: | ||
"aggregated.txt", | ||
output: | ||
"processed.txt", | ||
shell: | ||
"exit 1; echo PROCESSED > {output}" | ||
|
||
|
||
rule process2: | ||
input: | ||
"processed.txt", | ||
output: | ||
"processed2.txt", | ||
shell: | ||
"echo PROCESSED2 > {output}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
AGGREGATED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
AGGREGATED |
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
PROCESSED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
PROCESSED2 |
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
PROCESSED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
PROCESSED2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters