Solutions: rules and dependencies
3.1 Rebuild only the table
rm summary.tsv
snakemake --cores 2 --scheduler greedy --dry-run
snakemake --cores 2 --scheduler greedy
cat summary.tsv
Expect one collect job and all, with zero run_app jobs. All ten inputs already exist. The collector writes a header (file, value) and the ten rows in the order specified by RESULTS. The random numbers are reused.
3.2 One target versus the collection
From an up-to-date workflow:
rm results/output_6.txt
snakemake --cores 2 --scheduler greedy results/output_6.txt
snakemake --cores 2 --scheduler greedy --dry-run
snakemake --cores 2 --scheduler greedy
The explicit target runs one run_app job and stops. It does not request any downstream table, so the existing table is not updated during that invocation. The subsequent default run requests summary.tsv, notices the regenerated input and runs collect plus all, with no generator jobs. The table is now consistent with the files on disk. The input's contents can coincide by chance, but its regeneration still matters to dependency tracking.
3.3 Extension: invalid input must fail
The Python command exits with a nonzero status and a ValueError that names invalid-example.txt and the expected result: N format. In a fresh exercise directory it creates no invalid-summary.tsv: output writing follows input parsing. The source result files remain unchanged.
The collector checks the text format and the integer range 0–99. It neither proves randomness nor tests a physical or statistical model. The same separation applies to the upcoming scientific example: workflow completion means that the declared operations succeeded; scientific validation needs separate checks of the model, data and uncertainty analysis.
Continue with designing a scientific workflow.