Debugging¶
Techniques for debugging pipeline issues.
Debugging Workflow¶
flowchart TD
A[Rule Failed] --> B{Check Log File}
B --> C[Clear Error Message?]
C -->|Yes| D[Fix Specific Issue]
C -->|No| E[Run Rule Manually]
E --> F[Reproduce Error?]
F -->|Yes| G[Debug Interactively]
F -->|No| H[Check Environment]
Log Files¶
Location¶
Rule logs are stored in the output directory:
| Text Only | |
|---|---|
1 | |
Viewing Logs¶
| Bash | |
|---|---|
1 2 3 4 5 6 7 8 | |
Cluster Job Logs¶
| Bash | |
|---|---|
1 2 3 4 5 6 7 8 | |
| Bash | |
|---|---|
1 2 3 4 5 | |
Dry Run Analysis¶
Check DAG¶
Preview what will run:
| Bash | |
|---|---|
1 | |
Print Commands¶
See the actual shell commands:
| Bash | |
|---|---|
1 | |
Generate DAG Image¶
Visualize the workflow:
| Bash | |
|---|---|
1 2 | |
Running Rules Manually¶
Identify the Command¶
Get the shell command for a rule:
| Bash | |
|---|---|
1 | |
Run in Interactive Shell¶
Start a pixi shell:
| Bash | |
|---|---|
1 | |
Then run commands manually:
| Bash | |
|---|---|
1 2 3 4 5 6 | |
Test Python Scripts¶
| Bash | |
|---|---|
1 2 3 4 5 6 7 8 9 | |
Snakemake Debugging¶
Summary Report¶
Get status of all files:
| Bash | |
|---|---|
1 | |
Detailed Report¶
Generate execution report:
| Bash | |
|---|---|
1 | |
Reason for Execution¶
See why rules will run:
| Bash | |
|---|---|
1 | |
Force Re-run¶
Force a specific rule:
| Bash | |
|---|---|
1 | |
Force from a rule onwards:
| Bash | |
|---|---|
1 | |
Common Debug Scenarios¶
Input File Missing¶
Symptom:
| Text Only | |
|---|---|
1 | |
Debug:
-
Check if prerequisite completed:
Bash 1ls -la results/path/to/expected/input -
Check DAG for dependencies:
Bash 1pixi run snakemake --dag <target> | dot -Tpng > debug.png
Rule Produces Empty Output¶
Debug:
-
Check the input file:
Bash 1samtools view results/bam/input.bam | head -
Run command manually with verbose output
-
Check filtering parameters
Memory Issues¶
Debug:
-
Monitor memory during execution:
Bash 1 2 3 4 5
# On local machine watch -n 1 free -h # Check cluster job bjobs -l <job_id> | grep -i mem -
Profile the rule:
Bash 1/usr/bin/time -v <command>
GPU Issues¶
Debug:
-
Check GPU availability:
Bash 1nvidia-smi -
Test CUDA:
Bash 1python -c "import torch; print(torch.cuda.is_available())" -
Check CUDA_VISIBLE_DEVICES:
Bash 1echo $CUDA_VISIBLE_DEVICES
Environment Issues¶
Check Installed Packages¶
| Bash | |
|---|---|
1 | |
Check Tool Versions¶
| Bash | |
|---|---|
1 2 3 4 5 6 7 8 | |
Recreate Environment¶
| Bash | |
|---|---|
1 2 3 | |
File Inspection¶
BAM Files¶
| Bash | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 | |
POD5 Files¶
| Bash | |
|---|---|
1 2 3 4 5 | |
TSV Files¶
| Bash | |
|---|---|
1 2 3 4 5 | |
Getting Help¶
Create a Minimal Example¶
When reporting issues:
- Identify the failing rule
-
Create minimal reproduction:
Bash 1pixi run snakemake <specific_output> -n -p --configfile=config/config-test.yml -
Include:
- Error message
- Log file contents
- Config used
- Environment info
File an Issue¶
Include:
| Markdown | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
| Text Only | |
|---|---|
1 2 3 | |