snakemake-executor-plugin-aws-batch-flex 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. snakemake_executor_plugin_aws_batch_flex-0.1.0/.github/workflows/release.yml +97 -0
  2. snakemake_executor_plugin_aws_batch_flex-0.1.0/.github/workflows/tests.yml +52 -0
  3. snakemake_executor_plugin_aws_batch_flex-0.1.0/.gitignore +23 -0
  4. snakemake_executor_plugin_aws_batch_flex-0.1.0/.release-please-manifest.json +3 -0
  5. snakemake_executor_plugin_aws_batch_flex-0.1.0/CHANGELOG.md +61 -0
  6. snakemake_executor_plugin_aws_batch_flex-0.1.0/LICENSE +21 -0
  7. snakemake_executor_plugin_aws_batch_flex-0.1.0/PKG-INFO +343 -0
  8. snakemake_executor_plugin_aws_batch_flex-0.1.0/README.md +310 -0
  9. snakemake_executor_plugin_aws_batch_flex-0.1.0/docs/further.md +84 -0
  10. snakemake_executor_plugin_aws_batch_flex-0.1.0/docs/guide.md +451 -0
  11. snakemake_executor_plugin_aws_batch_flex-0.1.0/docs/intro.md +6 -0
  12. snakemake_executor_plugin_aws_batch_flex-0.1.0/docs/reference.md +195 -0
  13. snakemake_executor_plugin_aws_batch_flex-0.1.0/docs/setup.md +215 -0
  14. snakemake_executor_plugin_aws_batch_flex-0.1.0/environment.yml +18 -0
  15. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/auto.smk +12 -0
  16. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/benchmark.smk +10 -0
  17. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/checkpoint.smk +21 -0
  18. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/conda.smk +13 -0
  19. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/conda_named.smk +8 -0
  20. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/config/pdsheet.tsv +3 -0
  21. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/directory.smk +13 -0
  22. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/disk.smk +26 -0
  23. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/ecr.smk +9 -0
  24. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/entrypoint.smk +28 -0
  25. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/envs/tiny.yaml +5 -0
  26. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/fanout.smk +17 -0
  27. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/fargate.smk +12 -0
  28. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/find-profile.sh +16 -0
  29. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/group.smk +15 -0
  30. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/mixed.smk +21 -0
  31. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/oom.smk +12 -0
  32. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/orphan-test.sh +22 -0
  33. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/orphans.smk +10 -0
  34. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/pdsheet.smk +15 -0
  35. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/pipeline.smk +108 -0
  36. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/pyimage.smk +11 -0
  37. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/pyrule.smk +15 -0
  38. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/retries.smk +9 -0
  39. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/rscript.smk +12 -0
  40. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/run.sh +106 -0
  41. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/script.smk +18 -0
  42. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/scripts/pandas_script.py +6 -0
  43. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/scripts/py_script.py +2 -0
  44. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/scripts/r_script.R +4 -0
  45. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/scripts/sh_script.sh +1 -0
  46. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/scripts/which_python.py +9 -0
  47. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/shadow.smk +9 -0
  48. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/shm.smk +15 -0
  49. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/tempdir.smk +13 -0
  50. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/conformance/wrapper.smk +18 -0
  51. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/smoke-test/README.md +14 -0
  52. snakemake_executor_plugin_aws_batch_flex-0.1.0/examples/smoke-test/Snakefile +23 -0
  53. snakemake_executor_plugin_aws_batch_flex-0.1.0/pyproject.toml +69 -0
  54. snakemake_executor_plugin_aws_batch_flex-0.1.0/release-please-config.json +13 -0
  55. snakemake_executor_plugin_aws_batch_flex-0.1.0/scripts/bake-ami.sh +178 -0
  56. snakemake_executor_plugin_aws_batch_flex-0.1.0/scripts/cleanup-ami.sh +83 -0
  57. snakemake_executor_plugin_aws_batch_flex-0.1.0/scripts/cleanup-jobdefs.sh +63 -0
  58. snakemake_executor_plugin_aws_batch_flex-0.1.0/scripts/setup.sh +205 -0
  59. snakemake_executor_plugin_aws_batch_flex-0.1.0/scripts/update-ami.sh +18 -0
  60. snakemake_executor_plugin_aws_batch_flex-0.1.0/src/snakemake_executor_plugin_aws_batch_flex/__init__.py +8 -0
  61. snakemake_executor_plugin_aws_batch_flex-0.1.0/src/snakemake_executor_plugin_aws_batch_flex/bootstrap.py +376 -0
  62. snakemake_executor_plugin_aws_batch_flex-0.1.0/src/snakemake_executor_plugin_aws_batch_flex/bundle.py +142 -0
  63. snakemake_executor_plugin_aws_batch_flex-0.1.0/src/snakemake_executor_plugin_aws_batch_flex/check.py +129 -0
  64. snakemake_executor_plugin_aws_batch_flex-0.1.0/src/snakemake_executor_plugin_aws_batch_flex/condacache.py +184 -0
  65. snakemake_executor_plugin_aws_batch_flex-0.1.0/src/snakemake_executor_plugin_aws_batch_flex/executor.py +725 -0
  66. snakemake_executor_plugin_aws_batch_flex-0.1.0/src/snakemake_executor_plugin_aws_batch_flex/headjob.py +244 -0
  67. snakemake_executor_plugin_aws_batch_flex-0.1.0/src/snakemake_executor_plugin_aws_batch_flex/hints.py +75 -0
  68. snakemake_executor_plugin_aws_batch_flex-0.1.0/src/snakemake_executor_plugin_aws_batch_flex/hostenv.py +221 -0
  69. snakemake_executor_plugin_aws_batch_flex-0.1.0/src/snakemake_executor_plugin_aws_batch_flex/imageinfo.py +207 -0
  70. snakemake_executor_plugin_aws_batch_flex-0.1.0/src/snakemake_executor_plugin_aws_batch_flex/jobdefs.py +221 -0
  71. snakemake_executor_plugin_aws_batch_flex-0.1.0/src/snakemake_executor_plugin_aws_batch_flex/jobfixes.py +65 -0
  72. snakemake_executor_plugin_aws_batch_flex-0.1.0/src/snakemake_executor_plugin_aws_batch_flex/jobmonitor.py +146 -0
  73. snakemake_executor_plugin_aws_batch_flex-0.1.0/src/snakemake_executor_plugin_aws_batch_flex/naming.py +16 -0
  74. snakemake_executor_plugin_aws_batch_flex-0.1.0/src/snakemake_executor_plugin_aws_batch_flex/orphans.py +51 -0
  75. snakemake_executor_plugin_aws_batch_flex-0.1.0/src/snakemake_executor_plugin_aws_batch_flex/patches.py +196 -0
  76. snakemake_executor_plugin_aws_batch_flex-0.1.0/src/snakemake_executor_plugin_aws_batch_flex/preflight.py +165 -0
  77. snakemake_executor_plugin_aws_batch_flex-0.1.0/src/snakemake_executor_plugin_aws_batch_flex/profiles.py +98 -0
  78. snakemake_executor_plugin_aws_batch_flex-0.1.0/src/snakemake_executor_plugin_aws_batch_flex/remote.py +409 -0
  79. snakemake_executor_plugin_aws_batch_flex-0.1.0/src/snakemake_executor_plugin_aws_batch_flex/settings.py +482 -0
  80. snakemake_executor_plugin_aws_batch_flex-0.1.0/src/snakemake_executor_plugin_aws_batch_flex/sizing.py +75 -0
  81. snakemake_executor_plugin_aws_batch_flex-0.1.0/src/snakemake_executor_plugin_aws_batch_flex/sources.py +83 -0
  82. snakemake_executor_plugin_aws_batch_flex-0.1.0/src/snakemake_executor_plugin_aws_batch_flex/tags.py +76 -0
  83. snakemake_executor_plugin_aws_batch_flex-0.1.0/src/snakemake_executor_plugin_aws_batch_flex/transfer.py +193 -0
  84. snakemake_executor_plugin_aws_batch_flex-0.1.0/src/snakemake_executor_plugin_aws_batch_flex/usage.py +208 -0
  85. snakemake_executor_plugin_aws_batch_flex-0.1.0/terraform/.terraform.lock.hcl +26 -0
  86. snakemake_executor_plugin_aws_batch_flex-0.1.0/terraform/README.md +43 -0
  87. snakemake_executor_plugin_aws_batch_flex-0.1.0/terraform/fargate.tf +79 -0
  88. snakemake_executor_plugin_aws_batch_flex-0.1.0/terraform/main.tf +340 -0
  89. snakemake_executor_plugin_aws_batch_flex-0.1.0/terraform/outputs.tf +52 -0
  90. snakemake_executor_plugin_aws_batch_flex-0.1.0/terraform/spot.tf +74 -0
  91. snakemake_executor_plugin_aws_batch_flex-0.1.0/terraform/terraform.tfvars.example +20 -0
  92. snakemake_executor_plugin_aws_batch_flex-0.1.0/terraform/userdata.snakemake.txt +47 -0
  93. snakemake_executor_plugin_aws_batch_flex-0.1.0/terraform/variables.tf +144 -0
  94. snakemake_executor_plugin_aws_batch_flex-0.1.0/terraform/versions.tf +13 -0
  95. snakemake_executor_plugin_aws_batch_flex-0.1.0/tests/conftest.py +2 -0
  96. snakemake_executor_plugin_aws_batch_flex-0.1.0/tests/fakeaws/sitecustomize.py +228 -0
  97. snakemake_executor_plugin_aws_batch_flex-0.1.0/tests/fixtures/existing_userdata.txt +12 -0
  98. snakemake_executor_plugin_aws_batch_flex-0.1.0/tests/test_bake_script.py +108 -0
  99. snakemake_executor_plugin_aws_batch_flex-0.1.0/tests/test_cleanup_ami.py +85 -0
  100. snakemake_executor_plugin_aws_batch_flex-0.1.0/tests/test_cleanup_jobdefs.py +57 -0
  101. snakemake_executor_plugin_aws_batch_flex-0.1.0/tests/test_conda_mount.py +45 -0
  102. snakemake_executor_plugin_aws_batch_flex-0.1.0/tests/test_condacache.py +164 -0
  103. snakemake_executor_plugin_aws_batch_flex-0.1.0/tests/test_conformance.py +94 -0
  104. snakemake_executor_plugin_aws_batch_flex-0.1.0/tests/test_host_env.py +55 -0
  105. snakemake_executor_plugin_aws_batch_flex-0.1.0/tests/test_imageinfo.py +101 -0
  106. snakemake_executor_plugin_aws_batch_flex-0.1.0/tests/test_integration.py +664 -0
  107. snakemake_executor_plugin_aws_batch_flex-0.1.0/tests/test_prereqs.py +50 -0
  108. snakemake_executor_plugin_aws_batch_flex-0.1.0/tests/test_script_python.py +59 -0
  109. snakemake_executor_plugin_aws_batch_flex-0.1.0/tests/test_setup.py +68 -0
  110. snakemake_executor_plugin_aws_batch_flex-0.1.0/tests/test_smkflex.py +589 -0
  111. snakemake_executor_plugin_aws_batch_flex-0.1.0/tests/test_tags.py +97 -0
  112. snakemake_executor_plugin_aws_batch_flex-0.1.0/tests/test_units.py +473 -0
  113. snakemake_executor_plugin_aws_batch_flex-0.1.0/tests/test_userdata.py +49 -0
@@ -0,0 +1,97 @@
1
+ name: release
2
+
3
+ # Releases are made by release-please from the commit messages (feat: ..., fix: ..., docs: ...):
4
+ # on every push to main it keeps a "release" pull request up to date, with the next version in
5
+ # pyproject.toml and the new CHANGELOG.md entries. Merging that pull request creates the GitHub
6
+ # release and tag, and then this workflow runs the tests and publishes to PyPI.
7
+ #
8
+ # Also: pushing a tag like v0.1.0 by hand publishes that version (used for 0.1.0, which
9
+ # release-please didn't make), and a manual run (Actions tab > release > Run workflow) publishes
10
+ # to TestPyPI. The tests (tests.yml) always run first, and nothing is uploaded unless they pass.
11
+ # Publishing uses PyPI trusted publishing (no tokens): register this workflow, release.yml, as a
12
+ # trusted publisher on pypi.org and test.pypi.org, with environments "pypi" and "testpypi".
13
+ on:
14
+ push:
15
+ branches: [main]
16
+ tags: ["v*"]
17
+ workflow_dispatch:
18
+
19
+ permissions:
20
+ contents: read
21
+
22
+ jobs:
23
+ release-please:
24
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
25
+ runs-on: ubuntu-24.04
26
+ permissions:
27
+ contents: write
28
+ issues: write
29
+ pull-requests: write
30
+ outputs:
31
+ release_created: ${{ steps.release.outputs.release_created }}
32
+ tag_name: ${{ steps.release.outputs.tag_name }}
33
+ steps:
34
+ - uses: googleapis/release-please-action@v4
35
+ id: release
36
+
37
+ tests:
38
+ needs: release-please
39
+ # a release was just created, or a tag was pushed by hand, or a manual run
40
+ if: >-
41
+ !cancelled() && (needs.release-please.outputs.release_created == 'true'
42
+ || startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch')
43
+ uses: ./.github/workflows/tests.yml
44
+
45
+ build:
46
+ needs: [release-please, tests]
47
+ if: ${{ !cancelled() && needs.tests.result == 'success' }}
48
+ runs-on: ubuntu-24.04
49
+ steps:
50
+ - uses: actions/checkout@v4
51
+ with:
52
+ # the release's tag (release-please), else what triggered the run
53
+ ref: ${{ needs.release-please.outputs.tag_name || github.ref }}
54
+ - uses: actions/setup-python@v5
55
+ with:
56
+ python-version: "3.12"
57
+ - name: Check the tag matches the version in pyproject.toml
58
+ if: needs.release-please.outputs.tag_name != '' || startsWith(github.ref, 'refs/tags/v')
59
+ run: |
60
+ tag="${{ needs.release-please.outputs.tag_name || github.ref_name }}"
61
+ v=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
62
+ [ "v$v" = "$tag" ] || { echo "tag $tag but pyproject says $v"; exit 1; }
63
+ - run: pip install build twine && python -m build && twine check dist/*
64
+ - uses: actions/upload-artifact@v4
65
+ with:
66
+ name: dist
67
+ path: dist/
68
+
69
+ testpypi:
70
+ needs: build
71
+ if: ${{ !cancelled() && needs.build.result == 'success' && github.event_name == 'workflow_dispatch' }}
72
+ runs-on: ubuntu-24.04
73
+ environment: testpypi
74
+ permissions:
75
+ id-token: write
76
+ steps:
77
+ - uses: actions/download-artifact@v4
78
+ with:
79
+ name: dist
80
+ path: dist/
81
+ - uses: pypa/gh-action-pypi-publish@release/v1
82
+ with:
83
+ repository-url: https://test.pypi.org/legacy/
84
+
85
+ pypi:
86
+ needs: build
87
+ if: ${{ !cancelled() && needs.build.result == 'success' && github.event_name == 'push' }}
88
+ runs-on: ubuntu-24.04
89
+ environment: pypi
90
+ permissions:
91
+ id-token: write
92
+ steps:
93
+ - uses: actions/download-artifact@v4
94
+ with:
95
+ name: dist
96
+ path: dist/
97
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,52 @@
1
+ name: tests
2
+
3
+ on:
4
+ push:
5
+ paths-ignore: ["**.md", "docs/**", "terraform/**", "LICENSE"]
6
+ pull_request:
7
+ paths-ignore: ["**.md", "docs/**", "terraform/**", "LICENSE"]
8
+ workflow_dispatch:
9
+ workflow_call: # release.yml runs the tests before it uploads anything
10
+ inputs:
11
+ full:
12
+ description: "every Python version and the newest Snakemake too"
13
+ type: boolean
14
+ default: true
15
+ schedule:
16
+ - cron: "0 6 * * 1" # weekly, to catch new Snakemake releases
17
+
18
+ jobs:
19
+ lint:
20
+ runs-on: ubuntu-24.04
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+ - uses: actions/setup-python@v5
24
+ with:
25
+ python-version: "3.12"
26
+ - run: pip install ruff && ruff check src tests
27
+
28
+ test:
29
+ runs-on: ubuntu-24.04
30
+ timeout-minutes: 30
31
+ strategy:
32
+ fail-fast: false
33
+ matrix:
34
+ # Pushes: Python 3.12 and the Snakemake baked into the AMI. Weekly, manual and
35
+ # before publishing: every Python version the plugin supports, and the newest Snakemake.
36
+ python: ${{ fromJSON((inputs.full || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && '["3.11", "3.12", "3.13"]' || '["3.12"]') }}
37
+ snakemake: ${{ fromJSON((inputs.full || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && '["9.27.0", "latest"]' || '["9.27.0"]') }}
38
+ name: test (Python ${{ matrix.python }}, Snakemake ${{ matrix.snakemake }})
39
+ steps:
40
+ - uses: actions/checkout@v4
41
+ - uses: actions/setup-python@v5
42
+ with:
43
+ python-version: ${{ matrix.python }}
44
+ - name: Install R (for the R script test)
45
+ run: sudo apt-get update -qq && sudo apt-get install -y -qq --no-install-recommends r-base-core
46
+ - name: Install
47
+ run: |
48
+ pip install -e ".[test]"
49
+ if [ "${{ matrix.snakemake }}" != latest ]; then pip install "snakemake==${{ matrix.snakemake }}"; else pip install -U snakemake; fi
50
+ snakemake --version
51
+ - name: Test
52
+ run: python -m pytest -q -ra -n auto # in parallel, one test per CPU
@@ -0,0 +1,23 @@
1
+ # local notes
2
+ CLAUDE.md
3
+ HANDOVER.md
4
+
5
+ # account-specific
6
+ terraform/terraform.tfvars
7
+ terraform/terraform.tfvars.bak-*
8
+ **/profile*/config.yaml
9
+ *.tfstate
10
+ tfplan
11
+ *.tfplan
12
+ *.tfstate.*
13
+ .terraform/
14
+ userdata.mime
15
+ # generated
16
+ conformance-*.log
17
+ .snakemake/
18
+ results/
19
+ __pycache__/
20
+ *.egg-info/
21
+ dist/
22
+ build/
23
+ .pytest_cache/
@@ -0,0 +1,61 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 (2026-10-28)
4
+
5
+ First release. Needs Snakemake 9 (9.5 or newer) and Python 3.11 to 3.13. Tested on Linux; macOS
6
+ should work, and on Windows use WSL.
7
+
8
+ ### Features
9
+
10
+ * run each rule as an AWS Batch job in the image from its `container:` directive, without
11
+ Snakemake or Python in the image
12
+ * Snakemake from a machine image (AMI) mounted read-only into EC2 jobs, or installed when the job
13
+ starts (Fargate, or without the AMI)
14
+ * mix EC2, Spot and Fargate queues in one run (`batch_queue` per rule); the platform is detected
15
+ per queue
16
+ * per-rule `threads`, `mem_mb`, `runtime`, `gpu`, `/dev/shm` size (`batch_shm_mb`), Fargate disk
17
+ (`disk_mb`), tags, Spot retries, fair-share priority and existing job definitions
18
+ * images with an `ENTRYPOINT` (`["python3"]`, tini, entrypoint scripts): it's read from the image's
19
+ registry and the job's command is made to suit it, as Batch can't change it (`batch_entrypoint`
20
+ if the registry can't be read)
21
+ * Python `script:` rules run in the image's own Python (3.10 or newer)
22
+ * conda environments and wrappers in images without conda, with built environments reused per
23
+ machine and optionally kept in S3 (`conda-cache`)
24
+ * retry jobs that ran out of memory with more memory (`oom-memory-factor`)
25
+ * failed jobs show the end of their log, with hints for known causes (out of memory, full disk,
26
+ missing package or storage plugin, S3 permissions, an image `ENTRYPOINT` in the way)
27
+ * startup checks of the queue, compute environments and roles; jobs left over from an
28
+ interrupted run are cancelled
29
+ * end-of-run table of what each rule used (vCPU- and GiB-hours); costs come from AWS Billing, by
30
+ the tags `snakemake-run-id` and `snakemake-rule` that every job carries
31
+ * peak memory, busy vCPUs and disk use per rule, with `set-resources:` and `set-threads:`
32
+ suggestions to paste
33
+ * every job gets the whole workflow folder (what git tracks, or all that `.gitignore` doesn't
34
+ exclude, and `config/`), so scripts that `shell:` runs, imported modules and sample sheets
35
+ reach it without git; `data/`, `results/`, `logs/` and `benchmarks/` stay behind, and more than
36
+ 100 MB (`max-sources-mb`) stops the run at the start
37
+ * the same Snakemake and package versions in every job, pinned to the AMI's or the local ones
38
+ * a missing input says that jobs read inputs from the bucket, and the `smkflex push` that uploads it
39
+ * runs that can't work stop at the start: a `workdir:` directive, a job command too long for ECS
40
+ * `script:` rules and pandas work in images that bring their own conda libraries (bioconda's)
41
+ * jobs can't use the instances' credentials, and the launcher policy can't register privileged
42
+ job definitions
43
+ * `smkflex run`: run Snakemake itself on AWS in a head job, from the current folder or a git
44
+ repository (`--git`, `--rev`, `--path`, `--add`), with `.snakemake` state (also with
45
+ `--persistence-backend db`) kept between runs and saved while it runs; one run per project
46
+ * `smkflex logs`, `status` and `cancel` for those runs
47
+ * `smkflex init`, `push` and `pull`: a project folder in the bucket, uploading inputs and
48
+ downloading results at the paths Snakemake uses
49
+ * `smkflex check`: checks the whole setup and says what to fix
50
+ * `scripts/setup.sh`: one-command setup of the AMI, queue, compute environment, roles, bucket,
51
+ log group and `smkflex` profile, with optional Spot and Fargate queues
52
+ * `scripts/update-ami.sh`, `cleanup-ami.sh` and `cleanup-jobdefs.sh` to update the AMI and remove
53
+ the plugin's old images and job definitions
54
+ * Terraform setup with 30-day job logs, optional expiry of old files in the bucket, and an IAM
55
+ policy for people who only run pipelines that can't stop or change other Batch work
56
+ * private images: ECR through the IAM roles, other registries through Secrets Manager
57
+
58
+ ### Documentation
59
+
60
+ * README with a step-by-step setup from an empty AWS account to a finished test run
61
+ * guide, reference and setup pages in `docs/`, and runnable tests on AWS in `examples/conformance/`
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Stephen Smith
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,343 @@
1
+ Metadata-Version: 2.5
2
+ Name: snakemake-executor-plugin-aws-batch-flex
3
+ Version: 0.1.0
4
+ Summary: Snakemake executor plugin for AWS Batch that runs every rule in its own container image
5
+ Project-URL: Homepage, https://github.com/SSmith-NUIG/snakemake-executor-plugin-aws-batch-flex
6
+ Project-URL: Documentation, https://github.com/SSmith-NUIG/snakemake-executor-plugin-aws-batch-flex#getting-started
7
+ Project-URL: Issues, https://github.com/SSmith-NUIG/snakemake-executor-plugin-aws-batch-flex/issues
8
+ Project-URL: Changelog, https://github.com/SSmith-NUIG/snakemake-executor-plugin-aws-batch-flex/blob/main/CHANGELOG.md
9
+ Author: Stephen Smith
10
+ License: MIT
11
+ License-File: LICENSE
12
+ Keywords: aws,aws-batch,bioinformatics,executor,plugin,snakemake
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
19
+ Requires-Python: >=3.11
20
+ Requires-Dist: boto3>=1.34
21
+ Requires-Dist: pyyaml
22
+ Requires-Dist: snakemake-interface-common<2,>=1.17.4
23
+ Requires-Dist: snakemake-interface-executor-plugins<10,>=9.3.2
24
+ Requires-Dist: snakemake-interface-storage-plugins<5,>=4.0.0
25
+ Provides-Extra: test
26
+ Requires-Dist: pytest; extra == 'test'
27
+ Requires-Dist: pytest-xdist; extra == 'test'
28
+ Requires-Dist: ruff; extra == 'test'
29
+ Requires-Dist: snakemake; extra == 'test'
30
+ Requires-Dist: snakemake-storage-plugin-fs; extra == 'test'
31
+ Requires-Dist: snakemake-storage-plugin-s3; extra == 'test'
32
+ Description-Content-Type: text/markdown
33
+
34
+ # snakemake-executor-plugin-aws-batch-flex
35
+
36
+ Run [Snakemake](https://snakemake.readthedocs.io) workflows on [AWS Batch](https://aws.amazon.com/batch/),
37
+ with each step running in whatever container image you choose: a stock image from Docker Hub,
38
+ quay.io/biocontainers, your own ECR repository, and so on. The images don't need Snakemake or
39
+ Python inside them.
40
+
41
+ In plain terms: you write a workflow on your own computer, and this plugin sends each step to
42
+ AWS, where machines are started for you, run the step in its container, save the results to S3
43
+ (Amazon's file storage) and shut down again when there's nothing left to do. You pay only while
44
+ machines are running.
45
+
46
+ How it works, briefly: a copy of Snakemake is built into the machine image (an "AMI") that the
47
+ AWS machines start from, and every job gets read access to it. That's why your containers don't
48
+ need it. On Fargate (AWS's serverless option, no machines to manage) Snakemake is installed into
49
+ the container when the job starts instead.
50
+
51
+ **How it differs from the aws-batch plugin.** The other AWS Batch executor in the Snakemake
52
+ plugin catalog,
53
+ [snakemake-executor-plugin-aws-batch](https://github.com/snakemake/snakemake-executor-plugin-aws-batch), runs
54
+ `snakemake` inside each job's container, so every image a rule uses needs Snakemake and the S3
55
+ storage plugin installed; the usual biocontainers and stock images can't be used as they are.
56
+ This plugin brings Snakemake to the job instead, so each rule can use any image, and conda envs
57
+ work in images without conda. It also sets up the AWS side in one command, mixes EC2, Spot and
58
+ Fargate queues in one run, can run Snakemake itself on AWS (`smkflex run`), retries jobs that
59
+ ran out of memory with more, and reports what each rule used, with the memory and threads to give it.
60
+
61
+ This page takes you from nothing to a finished test run ([Getting started](https://github.com/SSmith-NUIG/snakemake-executor-plugin-aws-batch-flex#getting-started)),
62
+ then shows how to run your own workflow and what you can set on each rule. The rest is in three
63
+ more pages:
64
+
65
+ - [Guide](https://github.com/SSmith-NUIG/snakemake-executor-plugin-aws-batch-flex/blob/main/docs/guide.md): published pipelines, moving from a cluster, long runs with `smkflex`,
66
+ conda, the usage table, Spot and Fargate, private images, and troubleshooting;
67
+ - [Reference](https://github.com/SSmith-NUIG/snakemake-executor-plugin-aws-batch-flex/blob/main/docs/reference.md): every profile setting and `smkflex` command, IAM, what has been
68
+ tested, and the limits;
69
+ - [Setup and upkeep](https://github.com/SSmith-NUIG/snakemake-executor-plugin-aws-batch-flex/blob/main/docs/setup.md): university and company accounts, updating the machine image,
70
+ setting up by hand, and removing everything.
71
+
72
+ ## Getting started
73
+
74
+ These steps take you from nothing to a finished test run, in under an hour. They assume you're
75
+ comfortable typing commands into a terminal, but not that you know AWS or Snakemake.
76
+
77
+ It has been tested on Linux. On Windows, use [WSL](https://learn.microsoft.com/windows/wsl/install)
78
+ and run everything inside it. macOS should work but hasn't been tried.
79
+
80
+ ### 1. What you need
81
+
82
+ - An AWS account. Setting this up costs very little: building the machine image runs one small
83
+ machine for about 10 minutes, and keeping the image costs well under $1 a month. The test run
84
+ in step 5 costs a few cents. If your account comes from your university or company, read
85
+ [University and company accounts](https://github.com/SSmith-NUIG/snakemake-executor-plugin-aws-batch-flex/blob/main/docs/setup.md#university-and-company-accounts) first.
86
+ - Somewhere to run commands: your laptop is fine. When you run `snakemake` it has to stay on
87
+ (and online) until the workflow finishes, because it's what tells AWS what to do next;
88
+ `smkflex run` hands that to AWS instead (see [Long runs](https://github.com/SSmith-NUIG/snakemake-executor-plugin-aws-batch-flex/blob/main/docs/guide.md#long-runs-smkflex)).
89
+
90
+ ### 2. Install the tools
91
+
92
+ Install [Miniforge](https://github.com/conda-forge/miniforge#install) if you don't already have
93
+ `conda`. Then get this repository and create an environment with everything you need (Python,
94
+ Snakemake, Terraform, the AWS command-line tool and `snakedeploy`):
95
+
96
+ ```bash
97
+ git clone https://github.com/SSmith-NUIG/snakemake-executor-plugin-aws-batch-flex.git
98
+ cd snakemake-executor-plugin-aws-batch-flex
99
+ conda env create -f environment.yml
100
+ conda activate smk-aws
101
+ pip install -e .
102
+ ```
103
+
104
+ Run `conda activate smk-aws` again in every new terminal before the steps below.
105
+
106
+ Check it worked: `snakemake --version` should print a version number (9.x), and
107
+ `snakemake --help | grep aws-batch-flex` should list this plugin's settings.
108
+
109
+ ### 3. Connect to your AWS account
110
+
111
+ The command-line tools need an access key. In the [AWS console](https://console.aws.amazon.com/):
112
+
113
+ 1. Go to **IAM** > **Users** > **Create user**. Give it a name (e.g. `snakemake-admin`).
114
+ 2. On the permissions page choose **Attach policies directly** and tick **AdministratorAccess**.
115
+ (Setup creates machines, roles, a queue and a bucket, which needs broad permissions. Don't
116
+ use your account's root login for this.)
117
+ 3. Open the new user > **Security credentials** > **Create access key** > **Command Line
118
+ Interface (CLI)**. Copy the access key ID and secret access key.
119
+
120
+ Then in your terminal:
121
+
122
+ ```bash
123
+ aws configure
124
+ ```
125
+
126
+ Paste the two keys when asked. For the region, pick the one closest to you, e.g. `eu-west-1`
127
+ (Ireland) or `us-east-1` (N. Virginia), and use the same one everywhere below. Leave the output
128
+ format empty.
129
+
130
+ Check it worked: `aws sts get-caller-identity` should print your account number. (If you log in
131
+ through a university or company page instead, follow
132
+ [University and company accounts](https://github.com/SSmith-NUIG/snakemake-executor-plugin-aws-batch-flex/blob/main/docs/setup.md#university-and-company-accounts) for this step.)
133
+
134
+ ### 4. Set up AWS
135
+
136
+ One script does the rest of the setup. It finds your account's network, builds a machine image
137
+ with Snakemake on it (plus conda and pandas, which most published pipelines need), creates the
138
+ queue, roles and bucket with Terraform, and installs a Snakemake profile called `smkflex` in
139
+ `~/.config/snakemake/smkflex/`. A profile is a settings file: it tells Snakemake to use this
140
+ plugin, your queue and your bucket, and because it's installed by name, `snakemake --profile
141
+ smkflex` works in any folder. Use the region you picked in step 3:
142
+
143
+ ```bash
144
+ bash scripts/setup.sh --region eu-west-1
145
+ ```
146
+
147
+ It asks twice before creating anything. The first time is before building the machine image,
148
+ which takes 10 to 20 minutes. The second is after showing what Terraform will create (about 20
149
+ new resources, nothing changed or removed). At the end it checks the whole setup and says
150
+ `All good.`. If it stops halfway, fix what it says and run the same command again: it carries on
151
+ where it stopped.
152
+
153
+ Options: `--fargate` also creates a Fargate queue and `--spot` a cheaper Spot queue (see
154
+ [Spot and Fargate queues](https://github.com/SSmith-NUIG/snakemake-executor-plugin-aws-batch-flex/blob/main/docs/guide.md#spot-and-fargate-queues)), `--extra-package NAME` adds a Python
155
+ package to the image, and `--no-conda` leaves conda out. `bash scripts/setup.sh --help` lists the
156
+ rest. To do each step by hand instead, see [Setting up by hand](https://github.com/SSmith-NUIG/snakemake-executor-plugin-aws-batch-flex/blob/main/docs/setup.md#setting-up-by-hand).
157
+
158
+ Nothing is running (or costing money) yet: machines start when jobs arrive and stop when the
159
+ queue is empty.
160
+
161
+ ### 5. Run the test workflow
162
+
163
+ ```bash
164
+ cd examples/smoke-test
165
+ snakemake --profile smkflex
166
+ ```
167
+
168
+ What happens: Snakemake uploads the workflow to S3 and submits two jobs. The first time, AWS has
169
+ to start a machine, so the jobs show as waiting for a few minutes. Then each job runs in its own
170
+ container (`debian:12`, which has no Python) and writes its result to S3. When it's finished
171
+ you'll see `3 of 3 steps (100%) done`, followed by a table of what the run used.
172
+
173
+ Download the results from the bucket and look at them:
174
+
175
+ ```bash
176
+ smkflex pull results --profile smkflex
177
+ cat results/hello.txt results/sum.txt
178
+ ```
179
+
180
+ The first says hello from Debian and `image has NO python3`; the second is `45`. A few minutes
181
+ later the machine shuts itself down.
182
+
183
+ ### 6. Set a budget alert
184
+
185
+ Before running real pipelines, set a budget alert, so a mistake (a huge job, or a forgotten
186
+ setting) costs an email rather than a surprise bill. In the AWS console, **Billing and Cost
187
+ Management** > **Budgets** > **Create budget** > **Use a template** > **Monthly cost budget**:
188
+ enter an amount (e.g. $50) and your email address. AWS then mails you at 85% and 100% of it, and
189
+ when the month's forecast goes over. It takes two minutes and costs nothing.
190
+
191
+ As a rough guide: compute costs about $0.05 per vCPU-hour on normal instances (a third of that
192
+ on Spot), so a job using 4 vCPUs for an hour costs about $0.20. The published RNA-seq pipeline
193
+ in [Running a published pipeline](https://github.com/SSmith-NUIG/snakemake-executor-plugin-aws-batch-flex/blob/main/docs/guide.md#running-a-published-pipeline) ran its 53 test jobs for about
194
+ $0.10; a real run with 20 samples of 30 million reads should be a few dollars (an estimate, not
195
+ measured). S3 storage is about $0.02 per GB per month. The table at the end of every run shows
196
+ what that run used (see [What a run used](https://github.com/SSmith-NUIG/snakemake-executor-plugin-aws-batch-flex/blob/main/docs/guide.md#what-a-run-used)).
197
+
198
+ That's the setup done. Next, depending on what you're running:
199
+
200
+ - a workflow of your own: [Your own workflow](https://github.com/SSmith-NUIG/snakemake-executor-plugin-aws-batch-flex#your-own-workflow);
201
+ - a pipeline from the Snakemake workflow catalog: [Running a published pipeline](https://github.com/SSmith-NUIG/snakemake-executor-plugin-aws-batch-flex/blob/main/docs/guide.md#running-a-published-pipeline);
202
+ - a pipeline you've been running on a cluster: read [Your own workflow](https://github.com/SSmith-NUIG/snakemake-executor-plugin-aws-batch-flex#your-own-workflow),
203
+ then [Coming from a cluster](https://github.com/SSmith-NUIG/snakemake-executor-plugin-aws-batch-flex/blob/main/docs/guide.md#coming-from-a-cluster).
204
+
205
+ ## Running your workflows
206
+
207
+ ### Your own workflow
208
+
209
+ A Snakemake workflow is a file called `Snakefile` made of rules. Each rule says what files it
210
+ makes (`output`), what it needs (`input`), which container to use, and the command to run:
211
+
212
+ ```python
213
+ rule count_lines:
214
+ input: "data/reads.txt"
215
+ output: "results/count.txt"
216
+ container: "docker://debian:12"
217
+ resources: mem_mb=1000
218
+ shell: "wc -l < {input} > {output}"
219
+ ```
220
+
221
+ Snakemake works out the order from the file names, and with this plugin each rule runs as a
222
+ Batch job. The [Snakemake tutorial](https://snakemake.readthedocs.io/en/stable/tutorial/tutorial.html)
223
+ explains rules, wildcards and the rest; everything in it works here, with the differences listed
224
+ under [Limits](https://github.com/SSmith-NUIG/snakemake-executor-plugin-aws-batch-flex/blob/main/docs/reference.md#limits).
225
+
226
+ Each workflow lives in its own project folder, and its files live in your S3 bucket: jobs read
227
+ their inputs from there, never from your computer, so upload them first, and write their outputs
228
+ there. Put the `Snakefile` in a new folder and,
229
+ in that folder:
230
+
231
+ ```bash
232
+ smkflex init # gives this project its own folder in the bucket
233
+ smkflex push data # uploads data/reads.txt to it
234
+ snakemake --profile smkflex # runs the workflow
235
+ smkflex pull results # downloads results/ from it
236
+ ```
237
+
238
+ `smkflex init` writes the project's own settings file, `profiles/default/config.yaml`, with the
239
+ project's folder in the bucket (`s3://YOUR-BUCKET/snakemake/<folder name>`, so each project's
240
+ `results/` stay apart), and adds `data/`, `results/` and the like to the folder's `.gitignore`.
241
+ Snakemake loads that file by itself, on top of the `smkflex` profile, so it's also the place for
242
+ anything this workflow needs (memory, conda, retries, see [Tuning jobs](https://github.com/SSmith-NUIG/snakemake-executor-plugin-aws-batch-flex/blob/main/docs/guide.md#tuning-jobs)); the
243
+ `smkflex` profile keeps what's the same for every workflow (your queue, bucket and roles).
244
+
245
+ `data` is only this example's folder: push whatever files and folders your rules and sample
246
+ sheets name (`smkflex push reads samples.tsv`), and pull whichever outputs you want
247
+ (`smkflex pull results/qc`). `push` and `pull` skip files that are already there with the same
248
+ size (`--dry-run` only lists them) and also take absolute paths (see
249
+ [Coming from a cluster](https://github.com/SSmith-NUIG/snakemake-executor-plugin-aws-batch-flex/blob/main/docs/guide.md#coming-from-a-cluster)); paths that go up out of the project folder
250
+ (`../raw`) can't be mapped to storage, so use an absolute path for those. If something you push
251
+ isn't in `.gitignore`, `push` says so, since `smkflex run` would otherwise send it along with
252
+ the workflow.
253
+ `export SNAKEMAKE_PROFILE=smkflex` saves typing `--profile` every time. `examples/conformance/`
254
+ has one small workflow per feature (scripts, conda, checkpoints, Fargate, ...) if you want to
255
+ see more.
256
+
257
+ ### Resources per rule
258
+
259
+ Everything about a job is set on its rule. An example with every option in the table below (a real
260
+ rule only needs the few it uses):
261
+
262
+ ```python
263
+ rule align:
264
+ input: "data/{sample}.fq"
265
+ output: "results/{sample}.sam"
266
+ container: "docker://quay.io/biocontainers/bwa:0.7.17--h7132678_9"
267
+ threads: 8
268
+ retries: 4
269
+ resources:
270
+ mem_mb=16000,
271
+ runtime=120, # minutes
272
+ batch_shm_mb=4096, # EC2 only
273
+ disk_mb=100000, # Fargate only
274
+ gpu=1, # needs a queue with GPU machines
275
+ batch_queue="smkflex-big-queue",
276
+ batch_platform="ec2", # only if the queue can't be looked up
277
+ batch_tags="stage=align,project=rnaseq",
278
+ batch_spot_retries=3, # Spot queues
279
+ batch_priority=500, # fair-share queues
280
+ batch_script_python="host", # script: rules only
281
+ # batch_entrypoint='["python3"]', # only if the image's registry can't be read
282
+ # batch_job_definition="my-jobdef", # instead of the plugin's own; it then sets the image
283
+ shell: "bwa mem -t {threads} ref.fa {input} > {output}"
284
+ ```
285
+
286
+ | On the rule | What it does on AWS |
287
+ |---|---|
288
+ | `container: "docker://..."` | The image the job runs in. Any registry works (Docker Hub, quay.io, ghcr.io, ECR...); `docker://` is optional. Rules without one use `aws-batch-flex-default-image`. Images with an `ENTRYPOINT` work too: Batch can't change it, so the plugin reads it from the registry and gives the jobs a command it runs. |
289
+ | `threads: 8` | Number of vCPUs requested. On EC2, a job bigger than the largest machine the queue may start waits forever (the plugin warns after `runnable-warn-minutes`). On Fargate, vCPUs and memory are rounded up to the nearest size Fargate offers (at most 16 vCPUs and 120 GiB). |
290
+ | `mem_mb=16000` (or `mem_mib`) | Memory requested, a hard limit. Snakemake itself runs inside the job too, so 256 MiB is added (`mem-overhead-mib`). Without it (many published pipelines don't set it), `default-resources` applies, or else 2048 MiB. A job that goes over it is stopped; with `--retries 2` (or `retries: 2` in the profile) it's retried with twice the memory, then four times (`oom-memory-factor`). The end-of-run table shows what each rule really used. |
291
+ | `retries: 2` | Not a resource but a rule setting (or `retries: 2` in the profile for every rule): how many times Snakemake runs a failed job again. A job that ran out of memory gets more on each retry (`oom-memory-factor`), and `attempt` lets a rule raise anything itself, e.g. `mem_mb=lambda wildcards, attempt: 4000 * attempt` (then the rule's own figure is used, not doubled on top). Jobs that lost their Spot machine are restarted by Batch instead (`batch_spot_retries`) and don't use these up. |
292
+ | `runtime=120` | Minutes before Batch stops the job (timeout); `"2h"` also works. To give every rule a timeout, put `runtime` in `default-resources`. |
293
+ | `batch_shm_mb=4096` | Size of `/dev/shm` (Docker's default is 64 MB), for tools that use shared memory, e.g. bwa-mem2 or PyTorch data loaders. What's stored there counts towards `mem_mb`. EC2 only. `shared_memory_size_mb` also works. |
294
+ | `disk_mb=100000` (or `disk_mib`) | Fargate only: disk space for the job, up to 200 GiB, rounded up to 25 GiB steps. Without it, Snakemake asks for twice the size of the job's input files, and jobs get at least 20 GiB (or `ephemeral-storage-gib`). On EC2 it's ignored: jobs share their machine's disk (see [Limits](https://github.com/SSmith-NUIG/snakemake-executor-plugin-aws-batch-flex/blob/main/docs/reference.md#limits)). |
295
+ | `gpu=1` | Number of GPUs (needs a queue with GPU instances; untested). |
296
+ | `batch_queue="other-queue"` | Send this rule to a different queue than the profile's. EC2, Spot and Fargate queues can be mixed in one workflow; the plugin works out which is which. |
297
+ | `batch_platform="fargate"` | Force the platform instead of detecting it from the queue (only needed if the plugin isn't allowed to look the queue up). |
298
+ | `batch_tags="k=v,k2=v2"` | Extra tags on this rule's jobs, e.g. for cost reports. Overrides profile tags with the same key. |
299
+ | `batch_spot_retries=0` | How often Batch retries this rule's job if its Spot instance is taken away (0-9; default from the profile, 2). `aws_batch_spot_attempts` (retries + 1) also works. |
300
+ | `batch_priority=500` | Scheduling priority, 0-9999, higher first. Only on queues with a fair-share policy. `aws_batch_scheduling_priority` also works. |
301
+ | `batch_job_definition="name"` | Use an existing job definition for this rule (see the `job-definition` setting). |
302
+ | `batch_script_python="host"` | For Python `script:` rules: use Snakemake's own Python instead of the image's. |
303
+ | `batch_entrypoint='["python3"]'` | The image's `ENTRYPOINT`, for when the plugin can't read it from the registry (it then warns at the start): a private registry without `registry-credentials`, or no network to it. `'[]'` for none. |
304
+
305
+ To change resources without editing the Snakefile (for a published pipeline, say), use
306
+ Snakemake's `set-resources`, `set-threads` and `default-resources` in the project's
307
+ `profiles/default/config.yaml`:
308
+
309
+ ```yaml
310
+ default-resources: [mem_mb=4000] # rules that set no memory
311
+ max-threads: 8 # caps rules written for big cluster nodes
312
+ set-resources:
313
+ align:
314
+ batch_queue: smkflex-big-queue
315
+ mem_mb: 32000
316
+ ```
317
+
318
+ Snakemake features that work as usual (each has a small example in `examples/conformance/`):
319
+ `shell:` commands; `script:` files in Python, R or bash; `run:` blocks; `conda:` environments and
320
+ wrappers (`wrapper:`); `retries: 2`, and resources that grow with each attempt, e.g.
321
+ `mem_mb=lambda wildcards, attempt: 4000 * attempt`; `group:` (grouped rules run as one Batch job,
322
+ so they must share an image), `checkpoint`, `temp()`, `directory()`, `shadow:`, `log:` and
323
+ `benchmark:`.
324
+
325
+ ### Most-used settings
326
+
327
+ Plugin settings go in a profile as `aws-batch-flex-NAME: value` (or on the command line as
328
+ `--aws-batch-flex-NAME value`); `setup.sh` writes the usual ones. The ones people change most:
329
+
330
+ | Setting (`aws-batch-flex-...`) | What it's for |
331
+ |---|---|
332
+ | `queue` | The Batch queue jobs go to. |
333
+ | `default-image` | The image for rules that have no `container:`. |
334
+ | `conda-cache` | Reuse built conda envs: per machine (default), or kept in S3 for later runs. |
335
+ | `oom-memory-factor` | How much more memory a job gets when it's retried after running out (default 2×). |
336
+ | `spot-retries` | How many times Batch restarts a job whose Spot machine was taken back. |
337
+ | `tags` | Extra tags on every job, e.g. to see costs by project. |
338
+
339
+ All of them, with their defaults, are in the [Reference](https://github.com/SSmith-NUIG/snakemake-executor-plugin-aws-batch-flex/blob/main/docs/reference.md#profile-settings).
340
+
341
+ ## License
342
+
343
+ MIT, see [LICENSE](https://github.com/SSmith-NUIG/snakemake-executor-plugin-aws-batch-flex/blob/main/LICENSE).