# 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](https://flux-framework.org/) 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](examples/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:
```bash
$ 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:
```bash
$ docker run -it flux-snake bash
```
And start a flux instance:
```bash
$ flux start --test-size=4
```
Go into the examples directory (where the Snakefile is) and run snakemake, targeting your executor plugin.
```bash
$ cd ./example
# This says "use the custom executor module named snakemake_executor_plugin_flux"
$ snakemake --jobs 1 --executor flux
```
```console
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:
```bash
docker run -it -v $PWD/:/home/fluxuser/plugin flux-snake bash
```
The instructions for creating and scaffolding this plugin are [here](https://github.com/snakemake/poetry-snakemake-plugin#scaffolding-an-executor-plugin).
Instructions for writing your plugin with examples are provided via the [snakemake-executor-plugin-interface](https://github.com/snakemake/snakemake-executor-plugin-interface).
Raw data
{
"_id": null,
"home_page": "https://github.com/snakemake/snakemake-executor-plugin-flux",
"name": "snakemake-executor-plugin-flux",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.11,<4.0",
"maintainer_email": "",
"keywords": "snakemake,plugin,executor,flux,flux-framework",
"author": "vsoch",
"author_email": "vsoch@users.noreply.github.com",
"download_url": "https://files.pythonhosted.org/packages/60/61/96ae06fc0d09d9d63587bed7d6d0bd3940fddba45a67b637238b50d19dc9/snakemake_executor_plugin_flux-0.1.0.tar.gz",
"platform": null,
"description": "# Snakemake Executor Flux\n\nThis is an example implementation for an external snakemake plugin.\nSince we already have one for Flux (and it can run in a container) the example\nis for Flux. You can use this repository as a basis to design your own executor to work\nwith snakemake!\n\n## Usage\n\n### Tutorial\n\nFor this tutorial you will need Docker installer.\n\n[Flux-framework](https://flux-framework.org/) is a flexible resource scheduler that can work on both high performance computing systems and cloud (e.g., Kubernetes).\nSince 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\nFlux container to interact with snakemake using the plugin here. You can use the [Dockerfile](examples/Dockerfile) that will provide a container with Flux and snakemake\nNote that we install from source and bind to `/home/fluxuser/snakemake` with the intention of being able to develop (if desired).\n\nFirst, build the container:\n\n```bash\n$ docker build -f example/Dockerfile -t flux-snake .\n```\n\nWe will add the plugin here to `/home/fluxuser/plugin`, install it, and shell in as the fluxuser to optimally interact with flux.\nAfter the container builds, shell in:\n\n```bash\n$ docker run -it flux-snake bash\n```\n\nAnd start a flux instance:\n\n```bash\n$ flux start --test-size=4\n```\n\nGo into the examples directory (where the Snakefile is) and run snakemake, targeting your executor plugin.\n\n```bash\n$ cd ./example\n\n# This says \"use the custom executor module named snakemake_executor_plugin_flux\"\n$ snakemake --jobs 1 --executor flux\n```\n```console\nBuilding DAG of jobs...\nUsing shell: /bin/bash\nJob stats:\njob count min threads max threads\n------------------------ ------- ------------- -------------\nall 1 1 1\nmultilingual_hello_world 2 1 1\ntotal 3 1 1\n\nSelect jobs to execute...\n\n[Fri Jun 16 19:24:22 2023]\nrule multilingual_hello_world:\n output: hola/world.txt\n jobid: 2\n reason: Missing output files: hola/world.txt\n wildcards: greeting=hola\n resources: tmpdir=/tmp\n\nJob 2 has been submitted with flux jobid \u0192cjn4t3R (log: .snakemake/flux_logs/multilingual_hello_world/greeting_hola.log).\n[Fri Jun 16 19:24:32 2023]\nFinished job 2.\n1 of 3 steps (33%) done\nSelect jobs to execute...\n\n[Fri Jun 16 19:24:32 2023]\nrule multilingual_hello_world:\n output: hello/world.txt\n jobid: 1\n reason: Missing output files: hello/world.txt\n wildcards: greeting=hello\n resources: tmpdir=/tmp\n\nJob 1 has been submitted with flux jobid \u0192hAPLa79 (log: .snakemake/flux_logs/multilingual_hello_world/greeting_hello.log).\n[Fri Jun 16 19:24:42 2023]\nFinished job 1.\n2 of 3 steps (67%) done\nSelect jobs to execute...\n\n[Fri Jun 16 19:24:42 2023]\nlocalrule all:\n input: hello/world.txt, hola/world.txt\n jobid: 0\n reason: Input files updated by another job: hello/world.txt, hola/world.txt\n resources: tmpdir=/tmp\n\n[Fri Jun 16 19:24:42 2023]\nFinished job 0.\n3 of 3 steps (100%) done\nComplete log: .snakemake/log/2023-06-16T192422.186675.snakemake.log\n```\n\nAnd that's it! Continue reading to learn more about plugin design, and how you can also design your own executor\nplugin for use or development (that doesn't need to be added to upstream snakemake).\n\n## Developer\n\nTo do the same run but bind the local plugin directory:\n\n```bash\ndocker run -it -v $PWD/:/home/fluxuser/plugin flux-snake bash\n```\n\nThe instructions for creating and scaffolding this plugin are [here](https://github.com/snakemake/poetry-snakemake-plugin#scaffolding-an-executor-plugin).\nInstructions for writing your plugin with examples are provided via the [snakemake-executor-plugin-interface](https://github.com/snakemake/snakemake-executor-plugin-interface).\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A snakemake executor plugin for the Flux scheduler",
"version": "0.1.0",
"project_urls": {
"Documentation": "https://snakemake.github.io/snakemake-plugin-catalog/plugins/executor/flux.html",
"Homepage": "https://github.com/snakemake/snakemake-executor-plugin-flux",
"Repository": "https://github.com/snakemake/snakemake-executor-plugin-flux"
},
"split_keywords": [
"snakemake",
"plugin",
"executor",
"flux",
"flux-framework"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "27e4f7cb4276eb8e4e2230326ffeb3b559423c19d3e7480d1e1ad584ba355e34",
"md5": "c9fc0997d1819bc2f4bcec9744d5149b",
"sha256": "e0f02a1be00020bfb625e3d05d5ab584e0f56520d84ba729af957ecf2b9f8469"
},
"downloads": -1,
"filename": "snakemake_executor_plugin_flux-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c9fc0997d1819bc2f4bcec9744d5149b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11,<4.0",
"size": 6190,
"upload_time": "2024-01-11T07:26:55",
"upload_time_iso_8601": "2024-01-11T07:26:55.024867Z",
"url": "https://files.pythonhosted.org/packages/27/e4/f7cb4276eb8e4e2230326ffeb3b559423c19d3e7480d1e1ad584ba355e34/snakemake_executor_plugin_flux-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "606196ae06fc0d09d9d63587bed7d6d0bd3940fddba45a67b637238b50d19dc9",
"md5": "2edf3a7b5add6ee07f7ea9822137cc49",
"sha256": "92b1944dcf9ea163519a8879d4d638df2b3d0cd83ea6e8397d26046897811214"
},
"downloads": -1,
"filename": "snakemake_executor_plugin_flux-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "2edf3a7b5add6ee07f7ea9822137cc49",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11,<4.0",
"size": 5353,
"upload_time": "2024-01-11T07:26:56",
"upload_time_iso_8601": "2024-01-11T07:26:56.601914Z",
"url": "https://files.pythonhosted.org/packages/60/61/96ae06fc0d09d9d63587bed7d6d0bd3940fddba45a67b637238b50d19dc9/snakemake_executor_plugin_flux-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-11 07:26:56",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "snakemake",
"github_project": "snakemake-executor-plugin-flux",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "snakemake-executor-plugin-flux"
}