Snakemake executor plugin: LSF-Sanger
LSF is common high performance computing batch system. This is a version of the generic LSF executor plugin modified to better integrate with the Sanger compute environment and simplify pipeline execution.
Rule time and memory requirements are used to select an appropriate farm queue automatically, following the same criteria as the Sanger Nextflow profile.
The following readme is largely preserved from the original LSF executor plugin. lsf-sanger users do not have to specify queues for rules which specify the resources they need.
Installation
To use the lsf-sanger executor, install the latest release into the same Python environment as Snakemake.
$ pip install snakemake-executor-plugin-lsf-sanger
Workflow Resource Specifications
A workflow rule may support a number of resource specifications. For a LSF cluster, a mapping between Snakemake and LSF needs to be performed.
You can use the following specifications:
| LSF | Snakemake | Description |
|---|---|---|
-q |
lsf_queue |
the queue a rule/job is to use |
--W |
walltime |
the walltime per job in minutes |
-R "rusage[mem=<memory_amount>]" |
mem, mem_mb |
memory a cluster node must provide |
(mem: string with unit, mem_mb: i) |
||
-R "rusage[mem=<memory_amount>]" |
mem_mb_per_cpu |
memory per reserved CPU |
-R "rusage[ngpus_physical=<gpus>"] |
gpu |
GPUs to request for the job |
omit -R span[hosts=1] |
mpi |
Allow splitting across nodes for MPI |
-R span[ptile=<ptile>] |
ptile |
Processors per host. Reqires mpi |
Other bsub arguments |
lsf_extra |
Other args to pass to bsub (str) |
Each of these can be part of a rule, e.g.:
rule:
input: ...
output: ...
threads: 2
resources:
lsf_queue: <queue name>,
walltime: <some number>
walltime and runtime are synonyms.
Please note: as --mem and --mem-per-cpu are mutually exclusive,
their corresponding resource flags mem/mem_mb and
mem_mb_per_cpu are mutually exclusive, too. You can only reserve
memory a compute node has to provide or the memory required per CPU
(LSF does not make any distintion between real CPU cores and those
provided by hyperthreads). The executor will convert the provided options
based on cluster config.
Additional custom job configuration
There are various bsub options not directly supported via the resource
definitions shown above. You may use the lsf_extra resource to specify
additional flags to bsub:
rule myrule:
input: ...
output: ...
resources:
lsf_extra="-R a100 -gpu num=2"
You can use a configuration profile to specify such resources outside of the rule definition.
An example profile may look like this:
jobs: <max concurrent jobs>
executor: lsf-sanger
default-resources:
- 'lsf_project=<your LSF project>'
set-resources:
your_rule_name:
walltime: 1000
gpu: 2
Specifying Project and Queue
LSF clusters can have mandatory resource indicators for accounting and scheduling, Project and Queue, respectively. These resources are usually omitted from Snakemake workflows in order to keep the workflow definition independent from the platform. However, it is also possible to specify them inside of the workflow as resources in the rule definition (see the Resources document).
To specify them at the command line, define them as default resources:
$ snakemake --executor lsf-sanger --default-resources lsf_project=<your LSF project> lsf_queue=<your LSF queue>
If individual rules require e.g. a different queue, you can override the default per rule:
$ snakemake --executor lsf-sanger --default-resources lsf_project=<your LSF project> lsf_queue=<your LSF queue> --set-resources <somerule>:lsf_queue=<some other queue>
Usually, it is advisable to persist such settings via a configuration profile, which can be provided system-wide, per user, and in addition per workflow.
Ordinary SMP jobs
Most jobs will be carried out by programs which are either single core
scripts or threaded programs, hence SMP (shared memory
programs) in nature. Any
given threads and mem_mb requirements will be passed to LSF:
rule a:
input: ...
output: ...
threads: 8
resources:
mem_mb=14000
This will give jobs from this rule 14GB of memory and 8 CPU cores. It is advisable to use resonable default resources, such that you don't need to specify them for every rule. Snakemake already has reasonable defaults built in, which are automatically activated when using any non-local executor (hence also with lsf). Use mem_mb_per_cpu to give the standard LSF type memory per CPU
MPI jobs
Snakemake's LSF backend also supports MPI jobs, see the MPI support document for details.
rule calc_pi:
output:
"pi.calc",
log:
"logs/calc_pi.log",
threads: 40
resources:
tasks=10,
mpi='mpirun',
shell:
"{resources.mpi} -np {resources.tasks} calc-pi-mpi > {output} 2> {log}"
$ snakemake --set-resources calc_pi:mpi="mpiexec" ...
Per-job vs per-core
By default, this plugin keeps the specified memory request as a per-job, as expected by the Sanger LSF cluster.
If for some reason you want the request to be per-CPU core (i.e. -R rusage[mem=<mem_mb/threads>]) then set the
environment variable SNAKEMAKE_LSF_MEMFMT to percpu.
The executor automatically detects the request unit from cluster configuration, so if your cluster does not use MB, you do not need to do anything.
Metadata
Release files for snakemake-executor-plugin-lsf-sanger 1.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| snakemake_executor_plugin_lsf_sanger-1.3.2.tar.gz | 15.6 kB | Without provenance | Details for snakemake_executor_plugin_lsf_sanger-1.3.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| snakemake_executor_plugin_lsf_sanger-1.3.2-py3-none-any.whl | Python 3 | none | any | Details for snakemake_executor_plugin_lsf_sanger-1.3.2-py3-none-any.whl |
Total release size: 29.7 kB
Release files / snakemake_executor_plugin_lsf_sanger-1.3.2.tar.gz
| Download URL | snakemake_executor_plugin_lsf_sanger-1.3.2.tar.gz |
|---|---|
| Size | 15.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
da836e50a9d88803d87772883e72f381b279e32d396ddbf39ce6ce99d5e631f2
|
|
BLAKE2b-256 checksum How to use checksums |
bfffb2ce4695846491033b87c7ccd692028fb9f5ff998f51a5dc411ef10aa15f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.12.3 Linux/5.15.0-177-generic
|
Release files / snakemake_executor_plugin_lsf_sanger-1.3.2-py3-none-any.whl
| Download URL | snakemake_executor_plugin_lsf_sanger-1.3.2-py3-none-any.whl |
|---|---|
| Size | 14.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
11226517539342d95082dd15260172aa3aff8eb9f8a4e9267d3e2b317b7fec25
|
|
BLAKE2b-256 checksum How to use checksums |
6d7851cde3c91387086df114235ee05cf537a28b73c9ea91806b5d7725439894
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.12.3 Linux/5.15.0-177-generic
|
Security for snakemake-executor-plugin-lsf-sanger 1.3.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.