Skip to content

Commit

Permalink
docs: note on using checkpoint mechanism only for input function, not…
Browse files Browse the repository at this point in the history
… for params or resources. (#2353)

### 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
johanneskoester committed Jul 17, 2023
1 parent 76aa964 commit 4be2f9d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/snakefiles/rules.rst
Expand Up @@ -2191,6 +2191,14 @@ To illustrate the possibilities of this mechanism, consider the following comple
"touch {output}"
As can be seen, the rule aggregate uses an input function.

.. sidebar:: Note

You don't need to use the checkpoint mechanism to determine parameter or resource values of downstream rules that would be based on the output of previous rules.
In fact, it won't even work because the checkpoint mechanism is only considered for input functions.
Instead, you can simply use normal parameter or resource functions that just assume that those output files are there. Snakemake will evaluate them immediately before
the job is scheduled, when the required files from upstream rules are already present.

Inside the function, we first retrieve the output files of the checkpoint ``somestep`` with the wildcards, passing through the value of the wildcard sample.
Upon execution, if the checkpoint is not yet complete, Snakemake will record ``somestep`` as a direct dependency of the rule ``aggregate``.
Once ``somestep`` has finished for a given sample, the input function will automatically be re-evaluated and the method ``get`` will no longer return an exception.
Expand Down

0 comments on commit 4be2f9d

Please sign in to comment.