Skip to main content

Snakemake Executor Flux

This is an example implementation for an external snakemake plugin. Since we already have one for Flux (and it can run in a container) the example is for Flux. You can use this repository as a basis to design your own executor to work with snakemake!

Usage

Tutorial

For this tutorial you will need Docker installer.

Flux-framework is a flexible resource scheduler that can work on both high performance computing systems and cloud (e.g., Kubernetes). Since it is more modern (e.g., has an official Python API) we define it under a cloud resource. For this example, we will show you how to set up a "single node" local Flux container to interact with snakemake using the plugin here. You can use the Dockerfile that will provide a container with Flux and snakemake Note that we install from source and bind to /home/fluxuser/snakemake with the intention of being able to develop (if desired).

First, build the container:

$ docker build -f example/Dockerfile -t flux-snake .

We will add the plugin here to /home/fluxuser/plugin, install it, and shell in as the fluxuser to optimally interact with flux. After the container builds, shell in:

$ docker run -it flux-snake bash

And start a flux instance:

$ flux start --test-size=4

Go into the examples directory (where the Snakefile is) and run snakemake, targeting your executor plugin.

$ cd ./example

# This says "use the custom executor module named snakemake_executor_plugin_flux"
$ snakemake --jobs 1 --executor flux
Building DAG of jobs...
Using shell: /bin/bash
Job stats:
job                         count    min threads    max threads
------------------------  -------  -------------  -------------
all                             1              1              1
multilingual_hello_world        2              1              1
total                           3              1              1

Select jobs to execute...

[Fri Jun 16 19:24:22 2023]
rule multilingual_hello_world:
    output: hola/world.txt
    jobid: 2
    reason: Missing output files: hola/world.txt
    wildcards: greeting=hola
    resources: tmpdir=/tmp

Job 2 has been submitted with flux jobid ƒcjn4t3R (log: .snakemake/flux_logs/multilingual_hello_world/greeting_hola.log).
[Fri Jun 16 19:24:32 2023]
Finished job 2.
1 of 3 steps (33%) done
Select jobs to execute...

[Fri Jun 16 19:24:32 2023]
rule multilingual_hello_world:
    output: hello/world.txt
    jobid: 1
    reason: Missing output files: hello/world.txt
    wildcards: greeting=hello
    resources: tmpdir=/tmp

Job 1 has been submitted with flux jobid ƒhAPLa79 (log: .snakemake/flux_logs/multilingual_hello_world/greeting_hello.log).
[Fri Jun 16 19:24:42 2023]
Finished job 1.
2 of 3 steps (67%) done
Select jobs to execute...

[Fri Jun 16 19:24:42 2023]
localrule all:
    input: hello/world.txt, hola/world.txt
    jobid: 0
    reason: Input files updated by another job: hello/world.txt, hola/world.txt
    resources: tmpdir=/tmp

[Fri Jun 16 19:24:42 2023]
Finished job 0.
3 of 3 steps (100%) done
Complete log: .snakemake/log/2023-06-16T192422.186675.snakemake.log

And that's it! Continue reading to learn more about plugin design, and how you can also design your own executor plugin for use or development (that doesn't need to be added to upstream snakemake).

Developer

To do the same run but bind the local plugin directory:

docker run -it -v $PWD/:/home/fluxuser/plugin flux-snake bash

The instructions for creating and scaffolding this plugin are here. Instructions for writing your plugin with examples are provided via the snakemake-executor-plugin-interface.

Metadata

Release files for snakemake-executor-plugin-flux 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for snakemake-executor-plugin-flux 0.1.1
File Size Uploaded Provenance Actions
snakemake_executor_plugin_flux-0.1.1.tar.gz 5.9 kB Without provenance Details for snakemake_executor_plugin_flux-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for snakemake-executor-plugin-flux 0.1.1
File Interpreter ABI Platform Actions
snakemake_executor_plugin_flux-0.1.1-py3-none-any.whl Python 3 none any Details for snakemake_executor_plugin_flux-0.1.1-py3-none-any.whl

Total release size: 12.9 kB

Release files / snakemake_executor_plugin_flux-0.1.1.tar.gz

Download URL snakemake_executor_plugin_flux-0.1.1.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
26655bd1cf5d7db5dfcfdfbd006c1db35968c0ad1772e0b010e64e6f71b00163
BLAKE2b-256 checksum
How to use checksums
00d61112d713606d6e3772468a691307574354907c64bc6df76cb92aafb36268
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.10.12 Linux/6.5.0-1015-azure

Release files / snakemake_executor_plugin_flux-0.1.1-py3-none-any.whl

Download URL snakemake_executor_plugin_flux-0.1.1-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5a287a02c84f9e0e91734f49a193769edc9a675f80d88ba374dfda6b72d651ad
BLAKE2b-256 checksum
How to use checksums
c0f44e2f7c197a74fcc2b458b47aaaccdddc2ac56efba6fdb0ba9826fe7f3cf7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.10.12 Linux/6.5.0-1015-azure

Security for snakemake-executor-plugin-flux 0.1.1

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page