Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ensure lazy evaluation of resource functions/callables (this als…
…o entails, for now, a removal of the thread statistics in the yellow job stats table); further, added some clarifying sentences about resource function evaluation to the docs (#2356) ### Description This is a test for lazy resource evaluation which currently fails. ### 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). --------- Co-authored-by: Johannes Köster <johannes.koester@uni-due.de>
- Loading branch information
1 parent
f770984
commit 4c591b7
Showing
8 changed files
with
55 additions
and
13 deletions.
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
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
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
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
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,28 @@ | ||
import os | ||
|
||
rule all: | ||
input: | ||
"results/bar.txt", | ||
|
||
rule foo: | ||
output: | ||
"results/foo.txt" | ||
shell: | ||
"touch {output}" | ||
|
||
def get_resources(wc): | ||
# usually, anything that raises a FileNotFoundError if the file is not present is fine here, even in dryrun. | ||
# However, since this test case shall ensure that the function is evaluated just before the actual execution | ||
# of the job, we additionally assert that the file is present. | ||
assert os.path.isfile("results/foo.txt"), "bug: resource function is not evaluated in a lazy way, just before job execution" | ||
return os.path.getsize("results/foo.txt") | ||
|
||
rule bar: | ||
input: | ||
"results/foo.txt" | ||
output: | ||
"results/bar.txt" | ||
resources: | ||
test=get_resources | ||
shell: | ||
"touch {output}" |
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