instructor resource
Instructor Notes
Lesson Structure
The lesson has five main episodes and one bonus episode:
Getting Started: Rules, Targets, and the DAGScaling with Wildcards for Parallel ProcessingDynamic File Discovery with CheckpointsContainersRunning on HTCondorBonus: Visualising the Workflow
The main story stays close to a realistic analysis pattern:
- start from a simple workflow
- scale to many files with wildcards
- introduce parallel processing across many files, and note that this pattern is often called scatter-gather
- show when dynamic discovery needs
checkpoint - show how software environments and batch execution fit around the same workflow logic
Recommended 90-Minute Live Path
For a 1.5-hour session, do not attempt to teach every page in full detail. A good live path is:
Getting Started: Rules, Targets, and the DAGScaling with Wildcards for Parallel ProcessingDynamic File Discovery with Checkpoints- a shorter pass through
Containers - a short wrap-up with
Running on HTCondor
Treat Bonus: Visualising the Workflow as optional or offline material.
Suggested Timing
0-10 min: motivation, setup check, and the “ask for outputs, not rule names” mindset10-25 min: first workflow,rule all, dry-runs, and reruns25-45 min: wildcards,expand(), and the main parallel-processing example45-60 min: checkpoints as a dynamic extension of the same example family60-75 min: containers,container:, and--sdm apptainer75-85 min: HTCondor profiles, executor plugin, and resource requests85-90 min: recap, questions, and pointers to bonus/offline material
If setup has to happen during the session, shorten the container and HTCondor parts and treat them mainly as orientation.
How to Use Each Episode
Getting Started
Use this as the first real hands-on episode.
Main ideas:
Snakefilerule,input,output,shell- asking for an output file
rule all- dry-runs and lazy re-execution
Teaching note:
- learners often try to run a rule name rather than request an output file
- the “works backwards from the target” idea is the key conceptual shift
Scaling with Wildcards for Parallel Processing
This is the main practical episode.
Main ideas:
- wildcards
expand()- parallel per-file processing, with a gather step at the end
--coresscript:
Teaching note:
- this is where the particle-physics framing really helps
- the example is intentionally simple, but it looks like a realistic file-by-file selection workflow
- the
CHUNKS = ["0", "1", "2"]list works best if you explicitly remind learners that these are file identifiers coming from filenames
Dynamic File Discovery with Checkpoints
Teach this as a short guided demo rather than a long coding exercise.
Main ideas:
- when ordinary wildcards are enough
- when a file list is only known at run time
checkpointcheckpoints.<name>.get()- dynamic DAG expansion
Teaching note:
- the episode has a useful intermediate milestone: first produce all file lists, then inspect one of them, and only afterwards show the full dynamic workflow
- prefer the explicit file-list-reading pattern in class
- keep
glob_wildcards()as an instructor-side aside, not as the default learner-facing pattern
Containers
This should stay in the main lesson, but it does not need to become a long infrastructure detour.
Main ideas:
container:--software-deployment-method apptainer/--sdm apptainerAPPTAINER_CACHEDIR- per-rule software environments
Teaching note:
- explicitly point out that
container:does not activate itself; learners need to run Snakemake with--sdm apptainer - the episode explains what happens if that option is omitted
- the cache-directory advice matters in practice, especially on shared systems
- the optional Pixi-task note is useful, but should stay a sidenote
Running on HTCondor
Treat this as a short reference-style wrap-up, not as a full live exercise.
Main ideas:
- install the HTCondor executor plugin in the Pixi environment
- use a workflow profile
- keep the
Snakefilelargely unchanged - request sensible resources
- think about batching
Teaching note:
- the page is deliberately self-contained, with copy-paste snippets for the
profile, a minimal
Snakefile, and an optional Pixi task - the CERN example repository is linked at the top, but the main page does not depend on learners chasing links
- this page should show where the workflow goes next, not turn into a long HTCondor tutorial
Bonus: Visualising the Workflow
Keep this as a bonus or offline material.
Main ideas:
--dag--rulegraph- dry-runs as the safest first preview
- Graphviz output
Teaching note:
- useful for learners who want a workflow picture
- not essential to the main learning arc
- if time is short, this is the first episode to skip
Offline or Optional Material
The following topics are better suited to self-study or follow-up discussion:
- Graphviz-based workflow visualisation
- more detailed HTCondor and EOS examples
- site-specific container and bind-mount details
- real-analysis integration and patching of external repositories
Features Covered in the Main Path
The lesson covers several important Snakemake features in the main path:
rule all- dry-runs
- wildcards
expand()script:checkpointcontainer:- workflow profiles
- HTCondor execution with the native plugin
Topics Worth Mentioning Briefly
Two features are only lightly covered and are worth mentioning in class, even if they do not need their own full episode:
threads:- per-rule
resources:
These fit naturally into the container or HTCondor discussion, because that is where learners start asking about CPU, memory, disk, and runtime.
Learner Trouble Spots to Watch
- Students often ask for a rule name instead of an output file.
- Students often place wildcards in
inputthat are not determined byoutput. - Students only really appreciate
checkpointafter first seeing a case where ordinary wildcards andexpand()are enough. - Learners may think
container:automatically enables Apptainer execution. - Too much infrastructure detail too early makes Snakemake feel harder than it is.
Teaching Note: Checkpoints and glob_wildcards()
In the checkpoint episode, prefer the explicit file-list-reading pattern as the main learner-facing example.
Why this works better for teaching:
- it uses the actual output of the checkpoint
- it makes the data flow more explicit
- it preserves any filtering, ordering, or bookkeeping done by the checkpoint
- it avoids making the checkpoint feel like “magic filesystem rescanning”
glob_wildcards() is useful in real workflows, especially when the
checkpoint materialises a directory whose contents should themselves be treated
as truth. However, it is less explicit because it rescans the filesystem for
matching paths rather than reading the checkpoint output directly.
If you mention glob_wildcards() in class, frame it as a convenience pattern,
not as the default or preferred pattern for this lesson.