Run on a Slurm-enabled system:
- Clone the repository
- Add your workflow configuration CSV file to the
workflows/directory - Create the conda environment:
conda env create --file=Environment.yaml- Activate the environment:
conda activate workflow_dispatcher- Run the dispatcher:
python workflow_dispatcher.pyThe dispatcher is intended to be executed periodically (e.g. every 15 minutes via cron or Slurm).
- Create a .csv in the
workflowsfolder - The csv has to contain:
name,input_data_path,data_regex,workflow_path,commandname: Name of your workflowinput_data_path: folder that shall be monitored for new fasta filesdata_regex: regex that all files that shall be processed matchworkflow_path: Path to the snakemake worfklow version that shall be executedcommand: Terminal command that has to be executed from theworkflow_pathto start the workflow -> Do not use--cores allbecause slurm struggles to allocate recources that way
- Each csv file can contain multiple lines with different regex and commands for the same workflow
- Example:
workflows/qc_test.csv
See containerise/README.md
Workflow configurations are loaded from CSV files in workflows/
Workflow configurations are loaded from CSV files in workflows/ and specifiy:
- input_data_path → root folder containing runs
- data_regex → pattern to match FASTQ files
- workflow_path → location of workflow scripts/config
- command → command to execute the workflow
- The dispatcher recursively scans all subdirectories below
input_data_path - Run directories are automatically detected based on the presence of
.fastq.gzfiles - Directories named
workflow_statusare ignored
- To avoid processing incomplete sequencing runs, workflows are only started after the sequencing data transfer has completed.
- The dispatcher searches parent directories of each run folder for a file named
CopyComplete.txt
- FASTQ files matching
data_regexare collected - Files beginning with
Undeterminedare ignored _R1and_R2are used to identify read pairs- Only complete R1/R2 pairs are accepted
- Empty or corrupted FASTQ files are ignored automatically
- Sample names are derived from FASTQ filenames by removing:
_R1.fastq.gz_R2.fastq.gz
- For each run, a CSV file samples.csv is written in workflow_path/config/pep.
| Status | Description |
|---|---|
READY |
Workflow is ready to start |
RUNNING |
Workflow is currently running |
DONE |
Workflow completed successfully |
FAILED |
Workflow execution failed |
BLOCKED |
Another run of the same workflow is already running |
Status files are stored as:
<workflow_name>.RUNNING
<workflow_name>.DONE
<workflow_name>.FAILED
Example:
workflow_status/amr_prediction.RUNNING
Only one instance of the same workflow is allowed to run at a time. If another run directory already contains:
<workflow_name>.RUNNING
the dispatcher stops processing additional runs for this workflow until the running job has finished.
Workflows are executed as Slurm jobs using sbatch.
For each workflow submission:
-
A temporary Slurm submission script is generated automatically
-
The configured conda environment is activated
-
The workflow command is executed inside the workflow directory
-
Execution order:
- Only one workflow is submitted at a time per configuration.
- Subfolders are treated as separate runs, independent from each other.
-
Slurm Logs:
Slurm stdout/stderr logs are written to:
<workflow_path>/logs/slurm/Example:
my_workflow/logs/slurm/123456.out
A global sample tracking file is maintained at:
sample_status.csv
This file contains the latest workflow status for every processed sample across all workflows.
| Column | Description |
|---|---|
sample_name |
Sample identifier |
workflow_name |
Workflow name |
sample_path |
Directory containing the FASTQ files |
status |
Current workflow status |
last_updated |
Timestamp of latest status update |
| The CSV file is automatically updated whenever sample states change. |
- Only one workflow job is submitted per dispatcher execution
- Run folders are processed sequentially
- Subdirectories are treated as independent sequencing runs
- The dispatcher exits immediately after submitting a workflow job
Problem: LockException: Error: Directory cannot be locked. Please make sure that no other Snakemake process is trying to create the same files in the following directory: /groups/ds/automation/qc_pipeline_test/QC_pre_NextSeq
Solution:
cd /path/to/snakemake/workflow
conda activate snakemake_9_slurm
snakemake --unlock
- Shall a new sample.csv sheet be created for every run? -> Can we just overwrite sample.csv? -> Yes
- config.yaml run_date: "" has to be overwritten as well. Is it the exactly the same everywhere? -> Shall be overwritten every time
- Is it sufficient to have only one active container per workflow? (Serial instead of parallel processing) -> Yes
- Base sm environment to start the container -> See shared user
- The containers use the unpacked DBs on ds/groups -> Whats the maximum size here? -> 140 GB
- What happens if the same workflow starts for two different sequencer outputs? Will that happen? One Workflow container per sequencer? -> One container is sufficient
- Can multiple users controll one cron job? Automation user that can be used from different people? -> Ask Marcel
- Clean up -> move results to "output" folder and delete everything else? -> Not needed
- Remove hard coded conda env from workflow_dispatcher.py
- Add test