snakemake-logger-plugin-prometheus 0.1.1__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.
- snakemake_logger_plugin_prometheus-0.1.1/.github/workflows/release-please.yml +47 -0
- snakemake_logger_plugin_prometheus-0.1.1/.gitignore +216 -0
- snakemake_logger_plugin_prometheus-0.1.1/CHANGELOG.md +18 -0
- snakemake_logger_plugin_prometheus-0.1.1/LICENSE +21 -0
- snakemake_logger_plugin_prometheus-0.1.1/PKG-INFO +105 -0
- snakemake_logger_plugin_prometheus-0.1.1/README.md +93 -0
- snakemake_logger_plugin_prometheus-0.1.1/pixi.lock +3133 -0
- snakemake_logger_plugin_prometheus-0.1.1/pyproject.toml +69 -0
- snakemake_logger_plugin_prometheus-0.1.1/src/snakemake_logger_plugin_prometheus/__init__.py +379 -0
- snakemake_logger_plugin_prometheus-0.1.1/tests/__init__.py +0 -0
- snakemake_logger_plugin_prometheus-0.1.1/tests/conftest.py +18 -0
- snakemake_logger_plugin_prometheus-0.1.1/tests/test_integration.py +86 -0
- snakemake_logger_plugin_prometheus-0.1.1/tests/test_unit.py +140 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
on:
|
|
2
|
+
push:
|
|
3
|
+
branches:
|
|
4
|
+
- main
|
|
5
|
+
|
|
6
|
+
name: release-please
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
release-please:
|
|
10
|
+
permissions:
|
|
11
|
+
contents: write
|
|
12
|
+
pull-requests: write
|
|
13
|
+
issues: write
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
outputs:
|
|
16
|
+
release_created: ${{ steps.release.outputs.release_created }}
|
|
17
|
+
steps:
|
|
18
|
+
- uses: googleapis/release-please-action@v4
|
|
19
|
+
id: release
|
|
20
|
+
with:
|
|
21
|
+
release-type: python
|
|
22
|
+
|
|
23
|
+
publish-pypi:
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
needs: release-please
|
|
26
|
+
if: ${{ needs.release-please.outputs.release_created }}
|
|
27
|
+
environment:
|
|
28
|
+
name: release
|
|
29
|
+
permissions:
|
|
30
|
+
id-token: write
|
|
31
|
+
|
|
32
|
+
steps:
|
|
33
|
+
- uses: actions/checkout@v4
|
|
34
|
+
|
|
35
|
+
- name: Install Pixi
|
|
36
|
+
uses: prefix-dev/setup-pixi@v0.9.4
|
|
37
|
+
with:
|
|
38
|
+
environments: publish
|
|
39
|
+
pixi-version: v0.65.0
|
|
40
|
+
|
|
41
|
+
- name: Build source and wheel distribution + check build
|
|
42
|
+
# this will build the source and wheel into the dist/ directory
|
|
43
|
+
run: |
|
|
44
|
+
pixi run build
|
|
45
|
+
|
|
46
|
+
- name: Publish distribution to PyPI
|
|
47
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
# Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
# poetry.lock
|
|
109
|
+
# poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
# pdm.lock
|
|
116
|
+
# pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
# pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# Redis
|
|
135
|
+
*.rdb
|
|
136
|
+
*.aof
|
|
137
|
+
*.pid
|
|
138
|
+
|
|
139
|
+
# RabbitMQ
|
|
140
|
+
mnesia/
|
|
141
|
+
rabbitmq/
|
|
142
|
+
rabbitmq-data/
|
|
143
|
+
|
|
144
|
+
# ActiveMQ
|
|
145
|
+
activemq-data/
|
|
146
|
+
|
|
147
|
+
# SageMath parsed files
|
|
148
|
+
*.sage.py
|
|
149
|
+
|
|
150
|
+
# Environments
|
|
151
|
+
.env
|
|
152
|
+
.envrc
|
|
153
|
+
.venv
|
|
154
|
+
env/
|
|
155
|
+
venv/
|
|
156
|
+
ENV/
|
|
157
|
+
env.bak/
|
|
158
|
+
venv.bak/
|
|
159
|
+
|
|
160
|
+
# Spyder project settings
|
|
161
|
+
.spyderproject
|
|
162
|
+
.spyproject
|
|
163
|
+
|
|
164
|
+
# Rope project settings
|
|
165
|
+
.ropeproject
|
|
166
|
+
|
|
167
|
+
# mkdocs documentation
|
|
168
|
+
/site
|
|
169
|
+
|
|
170
|
+
# mypy
|
|
171
|
+
.mypy_cache/
|
|
172
|
+
.dmypy.json
|
|
173
|
+
dmypy.json
|
|
174
|
+
|
|
175
|
+
# Pyre type checker
|
|
176
|
+
.pyre/
|
|
177
|
+
|
|
178
|
+
# pytype static type analyzer
|
|
179
|
+
.pytype/
|
|
180
|
+
|
|
181
|
+
# Cython debug symbols
|
|
182
|
+
cython_debug/
|
|
183
|
+
|
|
184
|
+
# PyCharm
|
|
185
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
186
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
188
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
189
|
+
# .idea/
|
|
190
|
+
|
|
191
|
+
# Abstra
|
|
192
|
+
# Abstra is an AI-powered process automation framework.
|
|
193
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
194
|
+
# Learn more at https://abstra.io/docs
|
|
195
|
+
.abstra/
|
|
196
|
+
|
|
197
|
+
# Visual Studio Code
|
|
198
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
199
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
200
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
201
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
202
|
+
# .vscode/
|
|
203
|
+
|
|
204
|
+
# Ruff stuff:
|
|
205
|
+
.ruff_cache/
|
|
206
|
+
|
|
207
|
+
# PyPI configuration file
|
|
208
|
+
.pypirc
|
|
209
|
+
|
|
210
|
+
# Marimo
|
|
211
|
+
marimo/_static/
|
|
212
|
+
marimo/_lsp/
|
|
213
|
+
__marimo__/
|
|
214
|
+
|
|
215
|
+
# Streamlit
|
|
216
|
+
.streamlit/secrets.toml
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.1 (2026-03-13)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* add release-please github workflow ([c26a6c9](https://github.com/tedil/snakemake-logger-plugin-prometheus/commit/c26a6c9e7178a1e2dff0eb6c2ad49044282d8d3c))
|
|
9
|
+
* early return on dryrun ([dc6a2d0](https://github.com/tedil/snakemake-logger-plugin-prometheus/commit/dc6a2d0a4ae435c2d9493ade6c0a6bfeb637ef58))
|
|
10
|
+
* early return on dryrun ([8d1103c](https://github.com/tedil/snakemake-logger-plugin-prometheus/commit/8d1103ce49b7cacbde2219698ab213112835b042))
|
|
11
|
+
* move release please gh workflow to correct dir ([a58e4c8](https://github.com/tedil/snakemake-logger-plugin-prometheus/commit/a58e4c84cb4fdb486a5e702cf131bde94076f603))
|
|
12
|
+
* move release please gh workflow to correct dir, part 2 ([c8aa04e](https://github.com/tedil/snakemake-logger-plugin-prometheus/commit/c8aa04e70ac6ab76ce0356dcda35f0b2bb13d97d))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Miscellaneous Chores
|
|
16
|
+
|
|
17
|
+
* bump version ([a8bfc6b](https://github.com/tedil/snakemake-logger-plugin-prometheus/commit/a8bfc6b77e900e1671a18f16b8a99fd684b2f826))
|
|
18
|
+
* bump version ([dfc247e](https://github.com/tedil/snakemake-logger-plugin-prometheus/commit/dfc247ec7907df15001d7495884c91f272bcac22))
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Till Hartmann
|
|
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,105 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: snakemake-logger-plugin-prometheus
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Snakemake logger plugin that exposes job info to prometheus.
|
|
5
|
+
Project-URL: repository, https://github.com/tedil/snakemake-logger-plugin-prometheus
|
|
6
|
+
Author-email: Till Hartmann <till.hartmann@bih-charite.de>
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Python: <4.0,>=3.11
|
|
9
|
+
Requires-Dist: prometheus-client<0.24,>=0.23.1
|
|
10
|
+
Requires-Dist: snakemake-interface-logger-plugins<3,>=2.0
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
|
|
13
|
+
# Snakemake Prometheus Logger Plugin
|
|
14
|
+
|
|
15
|
+
A Snakemake logger plugin that exposes workflow metrics via a Prometheus-compatible HTTP endpoint.
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
You can install this plugin via pip:
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
pip install snakemake-logger-plugin-prometheus
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Or via Pixi/Conda if available in your channels.
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
To use this logger, run Snakemake with the `--logger prometheus` flag.
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
snakemake --logger prometheus ...
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Pull Mode (Default)
|
|
36
|
+
|
|
37
|
+
By default, the metrics server runs on port `8000`. Prometheus scrapes this address.
|
|
38
|
+
You can change the port using the `--logger-prometheus-port` flag:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
snakemake --logger prometheus --logger-prometheus-port 9090 ...
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Push Mode (Pushgateway)
|
|
45
|
+
|
|
46
|
+
If you cannot expose a port or prefer pushing metrics, specify a Pushgateway URL.
|
|
47
|
+
The plugin will push metrics every 15 seconds.
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
snakemake --logger prometheus --logger-prometheus-push-gateway http://localhost:9091
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
You can optionally set the job name used in the Pushgateway (default: `"snakemake"`):
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
snakemake --logger prometheus --logger-prometheus-push-gateway http://localhost:9091 --logger-prometheus-push-job-name my-workflow
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Available Metrics
|
|
60
|
+
|
|
61
|
+
### Job Lifecycle
|
|
62
|
+
|
|
63
|
+
| Metric Name | Type | Labels | Description |
|
|
64
|
+
|:--------------------------------|:--------|:-----------------------------------|:----------------------------------------------------------------------------------------------------------|
|
|
65
|
+
| `snakemake_jobs_submitted` | Gauge | `rule` | Jobs known to the scheduler (Queued + Running). Increments when a job is ready, decrements when finished. |
|
|
66
|
+
| `snakemake_jobs_running` | Gauge | `rule` | Jobs actively executing. Increments when execution starts, decrements when finished. |
|
|
67
|
+
| `snakemake_jobs_finished_total` | Counter | `status` (finished/failed), `rule` | Cumulative count of completed jobs. Useful for throughput rates. |
|
|
68
|
+
| `snakemake_jobs_planned_total` | Gauge | `rule` | Total jobs planned for the workflow. Updates dynamically if checkpoints trigger DAG re-evaluation. |
|
|
69
|
+
|
|
70
|
+
### Resources
|
|
71
|
+
|
|
72
|
+
| Metric Name | Type | Labels | Description |
|
|
73
|
+
|:---------------------------------|:------|:-----------|:------------------------------------------------------------------------------------|
|
|
74
|
+
| `snakemake_resource_usage_total` | Gauge | `resource` | Total resources currently consumed by **Running** jobs (e.g., `threads`, `mem_mb`). |
|
|
75
|
+
| `snakemake_resource_limits` | Gauge | `resource` | Maximum resources available to the workflow (CLI limits or cluster capacity). |
|
|
76
|
+
|
|
77
|
+
### Workflow Status
|
|
78
|
+
|
|
79
|
+
| Metric Name | Type | Labels | Description |
|
|
80
|
+
|:------------------------------|:--------|:--------------------|:---------------------------------------|
|
|
81
|
+
| `snakemake_workflow_progress` | Gauge | `type` (done/total) | High-level progress counters. |
|
|
82
|
+
| `snakemake_errors_total` | Counter | None | Total number of workflow-level errors. |
|
|
83
|
+
|
|
84
|
+
## Grafana Query Examples
|
|
85
|
+
|
|
86
|
+
Here are common queries to visualize this data:
|
|
87
|
+
|
|
88
|
+
| Description | Query |
|
|
89
|
+
|:-----------------------------|:---------------------------------------------------------------------------------------------------------------------|
|
|
90
|
+
| **Queued Jobs** | `sum(snakemake_jobs_submitted) - sum(snakemake_jobs_running)` |
|
|
91
|
+
| **Running Jobs** | `sum(snakemake_jobs_running)` |
|
|
92
|
+
| **Throughput (Jobs/Minute)** | `sum(rate(snakemake_jobs_finished_total{status="finished"}[5m])) * 60` |
|
|
93
|
+
| **Resource Utilization %** | `sum(snakemake_resource_usage_total{resource="threads"}) / sum(snakemake_resource_limits{resource="threads"}) * 100` |
|
|
94
|
+
| **Failure Rate** | `sum(rate(snakemake_jobs_finished_total{status="failed"}[5m]))` |
|
|
95
|
+
|
|
96
|
+
## Development
|
|
97
|
+
|
|
98
|
+
This project uses [pixi](https://pixi.sh) for dependency management and [uv](https://docs.astral.sh/uv/) for
|
|
99
|
+
building/publishing.
|
|
100
|
+
|
|
101
|
+
- Install dependencies: `pixi install`
|
|
102
|
+
- Run tests: `pixi run test`
|
|
103
|
+
- Run code formatting and linting: `pixi run qc`
|
|
104
|
+
- Build package: `pixi run build`
|
|
105
|
+
- Publish package: `pixi run publish`
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Snakemake Prometheus Logger Plugin
|
|
2
|
+
|
|
3
|
+
A Snakemake logger plugin that exposes workflow metrics via a Prometheus-compatible HTTP endpoint.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
You can install this plugin via pip:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pip install snakemake-logger-plugin-prometheus
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or via Pixi/Conda if available in your channels.
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
To use this logger, run Snakemake with the `--logger prometheus` flag.
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
snakemake --logger prometheus ...
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Pull Mode (Default)
|
|
24
|
+
|
|
25
|
+
By default, the metrics server runs on port `8000`. Prometheus scrapes this address.
|
|
26
|
+
You can change the port using the `--logger-prometheus-port` flag:
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
snakemake --logger prometheus --logger-prometheus-port 9090 ...
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Push Mode (Pushgateway)
|
|
33
|
+
|
|
34
|
+
If you cannot expose a port or prefer pushing metrics, specify a Pushgateway URL.
|
|
35
|
+
The plugin will push metrics every 15 seconds.
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
snakemake --logger prometheus --logger-prometheus-push-gateway http://localhost:9091
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
You can optionally set the job name used in the Pushgateway (default: `"snakemake"`):
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
snakemake --logger prometheus --logger-prometheus-push-gateway http://localhost:9091 --logger-prometheus-push-job-name my-workflow
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Available Metrics
|
|
48
|
+
|
|
49
|
+
### Job Lifecycle
|
|
50
|
+
|
|
51
|
+
| Metric Name | Type | Labels | Description |
|
|
52
|
+
|:--------------------------------|:--------|:-----------------------------------|:----------------------------------------------------------------------------------------------------------|
|
|
53
|
+
| `snakemake_jobs_submitted` | Gauge | `rule` | Jobs known to the scheduler (Queued + Running). Increments when a job is ready, decrements when finished. |
|
|
54
|
+
| `snakemake_jobs_running` | Gauge | `rule` | Jobs actively executing. Increments when execution starts, decrements when finished. |
|
|
55
|
+
| `snakemake_jobs_finished_total` | Counter | `status` (finished/failed), `rule` | Cumulative count of completed jobs. Useful for throughput rates. |
|
|
56
|
+
| `snakemake_jobs_planned_total` | Gauge | `rule` | Total jobs planned for the workflow. Updates dynamically if checkpoints trigger DAG re-evaluation. |
|
|
57
|
+
|
|
58
|
+
### Resources
|
|
59
|
+
|
|
60
|
+
| Metric Name | Type | Labels | Description |
|
|
61
|
+
|:---------------------------------|:------|:-----------|:------------------------------------------------------------------------------------|
|
|
62
|
+
| `snakemake_resource_usage_total` | Gauge | `resource` | Total resources currently consumed by **Running** jobs (e.g., `threads`, `mem_mb`). |
|
|
63
|
+
| `snakemake_resource_limits` | Gauge | `resource` | Maximum resources available to the workflow (CLI limits or cluster capacity). |
|
|
64
|
+
|
|
65
|
+
### Workflow Status
|
|
66
|
+
|
|
67
|
+
| Metric Name | Type | Labels | Description |
|
|
68
|
+
|:------------------------------|:--------|:--------------------|:---------------------------------------|
|
|
69
|
+
| `snakemake_workflow_progress` | Gauge | `type` (done/total) | High-level progress counters. |
|
|
70
|
+
| `snakemake_errors_total` | Counter | None | Total number of workflow-level errors. |
|
|
71
|
+
|
|
72
|
+
## Grafana Query Examples
|
|
73
|
+
|
|
74
|
+
Here are common queries to visualize this data:
|
|
75
|
+
|
|
76
|
+
| Description | Query |
|
|
77
|
+
|:-----------------------------|:---------------------------------------------------------------------------------------------------------------------|
|
|
78
|
+
| **Queued Jobs** | `sum(snakemake_jobs_submitted) - sum(snakemake_jobs_running)` |
|
|
79
|
+
| **Running Jobs** | `sum(snakemake_jobs_running)` |
|
|
80
|
+
| **Throughput (Jobs/Minute)** | `sum(rate(snakemake_jobs_finished_total{status="finished"}[5m])) * 60` |
|
|
81
|
+
| **Resource Utilization %** | `sum(snakemake_resource_usage_total{resource="threads"}) / sum(snakemake_resource_limits{resource="threads"}) * 100` |
|
|
82
|
+
| **Failure Rate** | `sum(rate(snakemake_jobs_finished_total{status="failed"}[5m]))` |
|
|
83
|
+
|
|
84
|
+
## Development
|
|
85
|
+
|
|
86
|
+
This project uses [pixi](https://pixi.sh) for dependency management and [uv](https://docs.astral.sh/uv/) for
|
|
87
|
+
building/publishing.
|
|
88
|
+
|
|
89
|
+
- Install dependencies: `pixi install`
|
|
90
|
+
- Run tests: `pixi run test`
|
|
91
|
+
- Run code formatting and linting: `pixi run qc`
|
|
92
|
+
- Build package: `pixi run build`
|
|
93
|
+
- Publish package: `pixi run publish`
|