I have a use case in which a rule generates an arbitrary number of "checkpoint" files and a single output file. For example, "example.input" would produce:
- example_000.checkpoint
- example_001.checkpoint
- ...
- example_093.checkpoint (arbitrary number here)
- example.output (guaranteed non-dynamic output)
The checkpoints are intended to be used to restart from that point in the calculation, but I have additional use for them. However, I only need the first (e.g., example_000.checkpoint) and the last (e.g., example_093.checkpoint). How can I construct a rule such that my outputs are defined as:
rule example:
input:
{id}.input
output:
non_dynamic = {id}.output
first = {id}_{first}.checkpoint
last = {id}_{last}.checkpoint
# OR
checkpoints = dynamic({id}_{checkpoint}.checkpoint)
If I define new wildcards, I get the error "Not all output files of rule example contain the same wildcards." If I try to use dynamic output, I get the error "A rule with dynamic output may not define any non-dynamic output files."
Thanks in advance for any help!