snakemake-logger-plugin-stomp 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.
- snakemake_logger_plugin_stomp-0.1.0/.gitattributes +2 -0
- snakemake_logger_plugin_stomp-0.1.0/.github/workflows/ci.yml +55 -0
- snakemake_logger_plugin_stomp-0.1.0/.github/workflows/conventional-prs.yml +16 -0
- snakemake_logger_plugin_stomp-0.1.0/.github/workflows/release-please.yml +54 -0
- snakemake_logger_plugin_stomp-0.1.0/.gitignore +58 -0
- snakemake_logger_plugin_stomp-0.1.0/.release-please-manifest.json +3 -0
- snakemake_logger_plugin_stomp-0.1.0/CHANGELOG.md +13 -0
- snakemake_logger_plugin_stomp-0.1.0/LICENSE +21 -0
- snakemake_logger_plugin_stomp-0.1.0/PKG-INFO +66 -0
- snakemake_logger_plugin_stomp-0.1.0/README.md +39 -0
- snakemake_logger_plugin_stomp-0.1.0/commitlint.config.js +31 -0
- snakemake_logger_plugin_stomp-0.1.0/docs/further.md +265 -0
- snakemake_logger_plugin_stomp-0.1.0/docs/intro.md +67 -0
- snakemake_logger_plugin_stomp-0.1.0/pixi.lock +1912 -0
- snakemake_logger_plugin_stomp-0.1.0/pyproject.toml +126 -0
- snakemake_logger_plugin_stomp-0.1.0/release-please-config.json +11 -0
- snakemake_logger_plugin_stomp-0.1.0/src/snakemake_logger_plugin_stomp/__init__.py +440 -0
- snakemake_logger_plugin_stomp-0.1.0/src/snakemake_logger_plugin_stomp/formatters.py +161 -0
- snakemake_logger_plugin_stomp-0.1.0/tests/test_plugin.py +283 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
|
|
9
|
+
env:
|
|
10
|
+
PYTHON_VERSION: "3.11"
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
linting:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- name: Check out the code
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
|
+
with:
|
|
19
|
+
fetch-depth: 0
|
|
20
|
+
|
|
21
|
+
- name: Setup pixi
|
|
22
|
+
uses: prefix-dev/setup-pixi@v0.9.4
|
|
23
|
+
with:
|
|
24
|
+
cache: true
|
|
25
|
+
environments: dev
|
|
26
|
+
pixi-version: v0.63.2
|
|
27
|
+
|
|
28
|
+
- name: Check formatting
|
|
29
|
+
run: pixi run -e dev format-check
|
|
30
|
+
|
|
31
|
+
- name: Lint
|
|
32
|
+
run: pixi run -e dev lint
|
|
33
|
+
|
|
34
|
+
testing:
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
steps:
|
|
37
|
+
- name: Check out the code
|
|
38
|
+
uses: actions/checkout@v4
|
|
39
|
+
|
|
40
|
+
- name: Setup pixi
|
|
41
|
+
uses: prefix-dev/setup-pixi@v0.9.4
|
|
42
|
+
with:
|
|
43
|
+
cache: true
|
|
44
|
+
environments: dev
|
|
45
|
+
|
|
46
|
+
- name: Run tests with coverage
|
|
47
|
+
run: pixi run -e dev test
|
|
48
|
+
|
|
49
|
+
- name: Upload coverage reports to Codecov
|
|
50
|
+
uses: codecov/codecov-action@v4
|
|
51
|
+
with:
|
|
52
|
+
file: ./coverage-report/coverage.xml
|
|
53
|
+
fail_ci_if_error: false
|
|
54
|
+
env:
|
|
55
|
+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
name: PR
|
|
2
|
+
on:
|
|
3
|
+
pull_request_target:
|
|
4
|
+
types:
|
|
5
|
+
- opened
|
|
6
|
+
- reopened
|
|
7
|
+
- edited
|
|
8
|
+
- synchronize
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
title-format:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: amannn/action-semantic-pull-request@v3.4.0
|
|
15
|
+
env:
|
|
16
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
env:
|
|
9
|
+
PYTHON_VERSION: "3.11"
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
release-please:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
outputs:
|
|
15
|
+
release_created: ${{ steps.release.outputs.release_created }}
|
|
16
|
+
tag_name: ${{ steps.release.outputs.tag_name }}
|
|
17
|
+
steps:
|
|
18
|
+
- uses: googleapis/release-please-action@v4
|
|
19
|
+
id: release
|
|
20
|
+
with:
|
|
21
|
+
# In v4, configuration is typically done via .release-please-config.json
|
|
22
|
+
# But for simple Python projects, this should work with defaults
|
|
23
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
24
|
+
|
|
25
|
+
publish:
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
needs: release-please
|
|
28
|
+
if: ${{ needs.release-please.outputs.release_created }}
|
|
29
|
+
permissions:
|
|
30
|
+
contents: write
|
|
31
|
+
id-token: write
|
|
32
|
+
steps:
|
|
33
|
+
- name: Check out the code
|
|
34
|
+
uses: actions/checkout@v4
|
|
35
|
+
with:
|
|
36
|
+
fetch-depth: 0
|
|
37
|
+
|
|
38
|
+
- name: Setup pixi
|
|
39
|
+
uses: prefix-dev/setup-pixi@v0.9.4
|
|
40
|
+
with:
|
|
41
|
+
cache: true
|
|
42
|
+
environments: dev
|
|
43
|
+
pixi-version: v0.63.2
|
|
44
|
+
|
|
45
|
+
- name: Build distribution packages
|
|
46
|
+
run: pixi run -e dev build
|
|
47
|
+
|
|
48
|
+
- name: Validate build
|
|
49
|
+
run: pixi run -e dev check-build
|
|
50
|
+
|
|
51
|
+
- name: Publish to PyPI
|
|
52
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
53
|
+
with:
|
|
54
|
+
print-hash: true
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
.Python
|
|
7
|
+
build/
|
|
8
|
+
develop-eggs/
|
|
9
|
+
dist/
|
|
10
|
+
downloads/
|
|
11
|
+
eggs/
|
|
12
|
+
.eggs/
|
|
13
|
+
lib/
|
|
14
|
+
lib64/
|
|
15
|
+
parts/
|
|
16
|
+
sdist/
|
|
17
|
+
var/
|
|
18
|
+
wheels/
|
|
19
|
+
*.egg-info/
|
|
20
|
+
.installed.cfg
|
|
21
|
+
*.egg
|
|
22
|
+
MANIFEST
|
|
23
|
+
|
|
24
|
+
# Testing
|
|
25
|
+
.pytest_cache/
|
|
26
|
+
.coverage
|
|
27
|
+
coverage-report/
|
|
28
|
+
htmlcov/
|
|
29
|
+
.tox/
|
|
30
|
+
.nox/
|
|
31
|
+
|
|
32
|
+
# Environments
|
|
33
|
+
.env
|
|
34
|
+
.venv
|
|
35
|
+
env/
|
|
36
|
+
venv/
|
|
37
|
+
ENV/
|
|
38
|
+
env.bak/
|
|
39
|
+
venv.bak/
|
|
40
|
+
|
|
41
|
+
# Pixi
|
|
42
|
+
.pixi/
|
|
43
|
+
|
|
44
|
+
# IDE
|
|
45
|
+
.vscode/
|
|
46
|
+
.idea/
|
|
47
|
+
*.swp
|
|
48
|
+
*.swo
|
|
49
|
+
*~
|
|
50
|
+
.DS_Store
|
|
51
|
+
|
|
52
|
+
# Build artifacts
|
|
53
|
+
dist/
|
|
54
|
+
*.whl
|
|
55
|
+
*.tar.gz
|
|
56
|
+
|
|
57
|
+
# Legacy
|
|
58
|
+
setup.cfg
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.1.0](https://github.com/JeffersonLab/snakemake-logger-plugin-stomp/compare/snakemake-logger-plugin-stomp-v0.0.1...snakemake-logger-plugin-stomp-v0.1.0) (2026-03-02)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* initial plugin implementation ([4a05ede](https://github.com/JeffersonLab/snakemake-logger-plugin-stomp/commit/4a05ede3faebd045564ff2e574739b837358b690))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* remove editable install from pixi config ([bbb2a9f](https://github.com/JeffersonLab/snakemake-logger-plugin-stomp/commit/bbb2a9ff340821cf250f68e735540813cd97c7f8))
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) [year] [fullname]
|
|
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,66 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: snakemake-logger-plugin-stomp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Snakemake logger plugin for streaming events to STOMP message brokers
|
|
5
|
+
Project-URL: Homepage, https://github.com/JeffersonLab/snakemake-logger-plugin-stomp
|
|
6
|
+
Project-URL: Repository, https://github.com/JeffersonLab/snakemake-logger-plugin-stomp
|
|
7
|
+
Project-URL: Documentation, https://snakemake.github.io/snakemake-plugin-catalog/plugins/logger/stomp.html
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/JeffersonLab/snakemake-logger-plugin-stomp/issues
|
|
9
|
+
Author-email: Anil Panta <anilpanta2@gmail.org>
|
|
10
|
+
License: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: activemq,logger,messaging,plugin,rabbitmq,snakemake,stomp
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: System :: Logging
|
|
21
|
+
Classifier: Topic :: System :: Monitoring
|
|
22
|
+
Requires-Python: <4.0,>=3.11
|
|
23
|
+
Requires-Dist: snakemake-interface-common<2,>=1.22.0
|
|
24
|
+
Requires-Dist: snakemake-interface-logger-plugins<3,>=2.0.0
|
|
25
|
+
Requires-Dist: stomp-py>=8.2.0
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# Snakemake Logger Plugin for STOMP
|
|
29
|
+
|
|
30
|
+
Send Snakemake workflow events monitoring to a STOMP message broker (ActiveMQ, RabbitMQ, etc.) in real-time.
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install snakemake-logger-plugin-stomp
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Quick Start
|
|
39
|
+
```bash
|
|
40
|
+
snakemake --logger-plugin stomp \
|
|
41
|
+
--stomp-host localhost \
|
|
42
|
+
--stomp-port 61613 \
|
|
43
|
+
--stomp-user admin \
|
|
44
|
+
--stomp-password admin
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Or use a profile:
|
|
48
|
+
```yaml
|
|
49
|
+
# profiles/stomp/config.yaml
|
|
50
|
+
logger:
|
|
51
|
+
stomp:
|
|
52
|
+
host: "activemq.example.com"
|
|
53
|
+
port: 61613
|
|
54
|
+
user: "${STOMP_USER}"
|
|
55
|
+
password: "${STOMP_PASSWORD}"
|
|
56
|
+
queue: "/topic/snakemake.prod"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Features
|
|
60
|
+
|
|
61
|
+
- JSON event streaming to message brokers
|
|
62
|
+
- SSL/TLS support
|
|
63
|
+
- Configurable formatters (default + JLab SWF schema)
|
|
64
|
+
- Event filtering (include/exclude)
|
|
65
|
+
- Heartbeat management
|
|
66
|
+
- Environment variable support for secrets
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Snakemake Logger Plugin for STOMP
|
|
2
|
+
|
|
3
|
+
Send Snakemake workflow events monitoring to a STOMP message broker (ActiveMQ, RabbitMQ, etc.) in real-time.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install snakemake-logger-plugin-stomp
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
```bash
|
|
13
|
+
snakemake --logger-plugin stomp \
|
|
14
|
+
--stomp-host localhost \
|
|
15
|
+
--stomp-port 61613 \
|
|
16
|
+
--stomp-user admin \
|
|
17
|
+
--stomp-password admin
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Or use a profile:
|
|
21
|
+
```yaml
|
|
22
|
+
# profiles/stomp/config.yaml
|
|
23
|
+
logger:
|
|
24
|
+
stomp:
|
|
25
|
+
host: "activemq.example.com"
|
|
26
|
+
port: 61613
|
|
27
|
+
user: "${STOMP_USER}"
|
|
28
|
+
password: "${STOMP_PASSWORD}"
|
|
29
|
+
queue: "/topic/snakemake.prod"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Features
|
|
33
|
+
|
|
34
|
+
- JSON event streaming to message brokers
|
|
35
|
+
- SSL/TLS support
|
|
36
|
+
- Configurable formatters (default + JLab SWF schema)
|
|
37
|
+
- Event filtering (include/exclude)
|
|
38
|
+
- Heartbeat management
|
|
39
|
+
- Environment variable support for secrets
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
extends: ['@commitlint/config-conventional'],
|
|
3
|
+
rules: {
|
|
4
|
+
'type-enum': [
|
|
5
|
+
2,
|
|
6
|
+
'always',
|
|
7
|
+
[
|
|
8
|
+
'feat', // New feature
|
|
9
|
+
'fix', // Bug fix
|
|
10
|
+
'docs', // Documentation only
|
|
11
|
+
'style', // Formatting (no code change)
|
|
12
|
+
'refactor', // Code refactoring
|
|
13
|
+
'perf', // Performance improvement
|
|
14
|
+
'test', // Adding/updating tests
|
|
15
|
+
'chore', // Maintenance (build, deps, tooling)
|
|
16
|
+
'ci', // CI/CD changes
|
|
17
|
+
'build', // Build system changes
|
|
18
|
+
'revert', // Revert previous commit
|
|
19
|
+
],
|
|
20
|
+
],
|
|
21
|
+
'type-case': [2, 'always', 'lower-case'],
|
|
22
|
+
'type-empty': [2, 'never'],
|
|
23
|
+
'subject-empty': [2, 'never'],
|
|
24
|
+
'subject-full-stop': [2, 'never', '.'],
|
|
25
|
+
'subject-case': [0], // Allow any case
|
|
26
|
+
'header-max-length': [2, 'always', 72],
|
|
27
|
+
'body-leading-blank': [1, 'always'],
|
|
28
|
+
'body-max-line-length': [2, 'always', 100],
|
|
29
|
+
'footer-leading-blank': [1, 'always'],
|
|
30
|
+
},
|
|
31
|
+
};
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
# Advanced Configuration
|
|
2
|
+
|
|
3
|
+
## SSL/TLS Encryption
|
|
4
|
+
|
|
5
|
+
For production brokers requiring encrypted connections:
|
|
6
|
+
|
|
7
|
+
**Profile configuration:**
|
|
8
|
+
```yaml
|
|
9
|
+
# profiles/production/config.yaml
|
|
10
|
+
logger:
|
|
11
|
+
stomp:
|
|
12
|
+
host: "secure-broker.example.com"
|
|
13
|
+
port: 61614
|
|
14
|
+
use_ssl: true
|
|
15
|
+
cert_file: "/path/to/client.crt"
|
|
16
|
+
key_file: "/path/to/client.key"
|
|
17
|
+
queue: "/topic/snakemake.secure"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**Command line:**
|
|
21
|
+
```bash
|
|
22
|
+
snakemake --logger-plugin stomp \
|
|
23
|
+
--stomp-host secure-broker.example.com \
|
|
24
|
+
--stomp-port 61614 \
|
|
25
|
+
--stomp-use-ssl \
|
|
26
|
+
--stomp-cert-file /path/to/client.crt \
|
|
27
|
+
--stomp-key-file /path/to/client.key
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Event Filtering
|
|
31
|
+
|
|
32
|
+
Control which events generate messages to reduce noise or focus on specific workflow stages.
|
|
33
|
+
|
|
34
|
+
### Whitelist Approach
|
|
35
|
+
|
|
36
|
+
Only send specific events:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
snakemake --logger-plugin stomp \
|
|
40
|
+
--stomp-include-events "WORKFLOW_STARTED,JOB_STARTED,JOB_FINISHED,WORKFLOW_FINISHED"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Blacklist Approach
|
|
44
|
+
|
|
45
|
+
Exclude noisy events:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
snakemake --logger-plugin stomp \
|
|
49
|
+
--stomp-exclude-events "DEBUG,PROGRESS,RESOURCES_INFO"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Available events:** `WORKFLOW_STARTED`, `WORKFLOW_FINISHED`, `JOB_STARTED`, `JOB_FINISHED`, `JOB_ERROR`, `DEBUG`, `PROGRESS`, `RESOURCES_INFO`, and more.
|
|
53
|
+
|
|
54
|
+
## Built-in Formatters
|
|
55
|
+
|
|
56
|
+
### DefaultJSONFormatter (default)
|
|
57
|
+
|
|
58
|
+
Produces flat, easy-to-parse JSON:
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"timestamp": "2024-01-15T14:30:00Z",
|
|
63
|
+
"hostname": "compute-node-01",
|
|
64
|
+
"workflow_id": "550e8400-e29b-41d4-a716-446655440000",
|
|
65
|
+
"event_type": "JOB_FINISHED",
|
|
66
|
+
"level": "INFO",
|
|
67
|
+
"message": "Job 5 completed successfully"
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### JLabSWFFormatter
|
|
72
|
+
|
|
73
|
+
Nested schema compliant with JLab Scientific Workflow Facility standards:
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"schema_ref": "org.jlab.swf.event",
|
|
78
|
+
"schema_version": "1.0.0",
|
|
79
|
+
"event_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
|
80
|
+
"event_type": "SNAKEMAKE_JOB_FINISHED",
|
|
81
|
+
"event_time": "2024-01-15T14:30:00Z",
|
|
82
|
+
"source": {
|
|
83
|
+
"agent_id": "snakemake-compute-node-01",
|
|
84
|
+
"workflow_id": "550e8400-e29b-41d4-a716-446655440000",
|
|
85
|
+
"hostname": "compute-node-01"
|
|
86
|
+
},
|
|
87
|
+
"correlation": {
|
|
88
|
+
"run_number": "12345"
|
|
89
|
+
},
|
|
90
|
+
"payload": {
|
|
91
|
+
"msg": "Job 5 completed successfully",
|
|
92
|
+
"level": "INFO",
|
|
93
|
+
"name": "align_reads",
|
|
94
|
+
"jobid": 5,
|
|
95
|
+
"wildcards": {"sample": "A"},
|
|
96
|
+
"threads": 4,
|
|
97
|
+
"resources": {"mem_mb": 16000}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**To use JLabSWFFormatter:**
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
snakemake --logger-plugin stomp \
|
|
106
|
+
--stomp-formatter-class "snakemake_logger_plugin_stomp.formatters.JLabSWFFormatter"
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
The `SWF_RUN_NUMBER` environment variable can be set to populate the `correlation.run_number` field for tracking related workflow runs.
|
|
110
|
+
|
|
111
|
+
## Custom Formatters
|
|
112
|
+
|
|
113
|
+
Create your own formatter by implementing the `BaseFormatter` interface:
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
# my_formatter.py
|
|
117
|
+
from snakemake_logger_plugin_stomp.formatters import BaseFormatter
|
|
118
|
+
from datetime import UTC, datetime
|
|
119
|
+
|
|
120
|
+
class MyFormatter(BaseFormatter):
|
|
121
|
+
def format(self, record, workflow_metadata):
|
|
122
|
+
return {
|
|
123
|
+
"ts": datetime.now(UTC).isoformat(),
|
|
124
|
+
"host": workflow_metadata.get("hostname"),
|
|
125
|
+
"event": str(getattr(record, "event", "UNKNOWN")),
|
|
126
|
+
"msg": record.getMessage() if hasattr(record, "getMessage") else str(record.msg),
|
|
127
|
+
"custom_field": "my_value"
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Install your formatter in the same Python environment, then reference it:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
snakemake --logger-plugin stomp \
|
|
135
|
+
--stomp-formatter-class "my_formatter.MyFormatter"
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Heartbeat Tuning
|
|
139
|
+
|
|
140
|
+
STOMP heartbeats keep the connection alive and detect network failures. Configure intervals in milliseconds:
|
|
141
|
+
|
|
142
|
+
```yaml
|
|
143
|
+
logger:
|
|
144
|
+
stomp:
|
|
145
|
+
host: "broker.example.com"
|
|
146
|
+
heartbeat_send: 30000 # Client sends heartbeat every 30s (default: 10000ms = 10s)
|
|
147
|
+
heartbeat_receive: 30000 # Client expects broker heartbeat every 30s (default: 10000ms = 10s)
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**How it works:**
|
|
151
|
+
- `heartbeat_send`: How often the client sends heartbeat frames to the broker
|
|
152
|
+
- `heartbeat_receive`: How often the client expects to receive heartbeat frames from the broker
|
|
153
|
+
- Set to `0` to disable heartbeats entirely
|
|
154
|
+
|
|
155
|
+
**Do you need heartbeats for Snakemake?**
|
|
156
|
+
|
|
157
|
+
**YES, keep heartbeats enabled (default 10s)** if you have:
|
|
158
|
+
- Long-running jobs (hours) with infrequent events
|
|
159
|
+
- Workflows with idle periods waiting on external resources
|
|
160
|
+
- Unreliable networks (cloud, VPN, cross-datacenter connections)
|
|
161
|
+
- Enterprise firewalls/proxies that drop idle TCP connections
|
|
162
|
+
- Production workflows where silent connection loss is unacceptable
|
|
163
|
+
|
|
164
|
+
**NO, you can disable heartbeats (set to 0)** if you have:
|
|
165
|
+
- Short workflows (< 30 minutes) with frequent job events
|
|
166
|
+
- Localhost or same-datacenter broker (reliable network)
|
|
167
|
+
- Development/testing environment
|
|
168
|
+
- Jobs that start/finish frequently (events naturally keep connection alive)
|
|
169
|
+
|
|
170
|
+
**Tuning guidance:**
|
|
171
|
+
- **Default (10000ms = 10s)**: Good for most production workflows
|
|
172
|
+
- **Increase (30000-60000ms)**: For slow/congested networks to prevent false timeouts
|
|
173
|
+
- **Decrease (5000ms)**: For fast networks where you want quick failure detection
|
|
174
|
+
- **Disable (0)**: Only for local testing with reliable connections
|
|
175
|
+
- Both send and receive values should typically be the same
|
|
176
|
+
- Brokers may negotiate the actual interval based on their own configuration
|
|
177
|
+
|
|
178
|
+
**Example: Disable for local testing**
|
|
179
|
+
```yaml
|
|
180
|
+
logger:
|
|
181
|
+
stomp:
|
|
182
|
+
host: "localhost"
|
|
183
|
+
heartbeat_send: 0
|
|
184
|
+
heartbeat_receive: 0
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Queue vs Topic Destinations
|
|
188
|
+
|
|
189
|
+
STOMP supports both queue (point-to-point) and topic (publish-subscribe) semantics:
|
|
190
|
+
|
|
191
|
+
```yaml
|
|
192
|
+
# Queue - one consumer receives each message
|
|
193
|
+
queue: "/queue/snakemake.events"
|
|
194
|
+
|
|
195
|
+
# Topic - all subscribers receive each message
|
|
196
|
+
queue: "/topic/snakemake.broadcast"
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Use **queues** when you want load balancing across multiple consumers. Use **topics** when multiple systems need to receive all events (e.g., monitoring + archival + alerting).
|
|
200
|
+
|
|
201
|
+
## Complete Production Example
|
|
202
|
+
|
|
203
|
+
A full production configuration combining SSL, event filtering, custom formatter, and heartbeat tuning:
|
|
204
|
+
|
|
205
|
+
```yaml
|
|
206
|
+
# profiles/production-stomp/config.yaml
|
|
207
|
+
logger:
|
|
208
|
+
stomp:
|
|
209
|
+
host: "activemq.prod.internal"
|
|
210
|
+
port: 61614
|
|
211
|
+
use_ssl: true
|
|
212
|
+
cert_file: "/etc/certs/snakemake.crt"
|
|
213
|
+
key_file: "/etc/certs/snakemake.key"
|
|
214
|
+
queue: "/topic/snakemake.prod"
|
|
215
|
+
formatter_class: "snakemake_logger_plugin_stomp.formatters.JLabSWFFormatter"
|
|
216
|
+
include_events: "WORKFLOW_STARTED,JOB_STARTED,JOB_FINISHED,WORKFLOW_FINISHED,JOB_ERROR"
|
|
217
|
+
heartbeat_send: 30000
|
|
218
|
+
heartbeat_receive: 30000
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
**Usage:**
|
|
222
|
+
```bash
|
|
223
|
+
export STOMP_USER=workflow_user
|
|
224
|
+
export STOMP_PASSWORD=secure_password
|
|
225
|
+
export SWF_RUN_NUMBER=12345
|
|
226
|
+
snakemake --profile profiles/production-stomp
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## Troubleshooting
|
|
230
|
+
|
|
231
|
+
### Connection Issues
|
|
232
|
+
|
|
233
|
+
If the plugin fails to connect:
|
|
234
|
+
|
|
235
|
+
1. Verify the broker is running and accessible: `telnet <host> <port>`
|
|
236
|
+
2. Check firewall rules allow the STOMP port
|
|
237
|
+
3. Confirm credentials are correct
|
|
238
|
+
4. Review broker logs for authentication errors
|
|
239
|
+
|
|
240
|
+
### SSL Certificate Errors
|
|
241
|
+
|
|
242
|
+
If SSL connections fail:
|
|
243
|
+
|
|
244
|
+
1. Verify certificate paths are correct and readable
|
|
245
|
+
2. Ensure certificates match the broker hostname
|
|
246
|
+
3. Check certificate expiration dates
|
|
247
|
+
4. Try with `use_ssl: false` first to isolate SSL-specific issues
|
|
248
|
+
|
|
249
|
+
### No Events Appearing
|
|
250
|
+
|
|
251
|
+
If events aren't reaching your consumer:
|
|
252
|
+
|
|
253
|
+
1. Check event filtering settings (`include_events`/`exclude_events`)
|
|
254
|
+
2. Verify the correct destination (queue vs topic)
|
|
255
|
+
3. Confirm consumers are connected to the same queue/topic
|
|
256
|
+
4. Review Snakemake logs for plugin connection errors
|
|
257
|
+
|
|
258
|
+
### Performance Considerations
|
|
259
|
+
|
|
260
|
+
For workflows with hundreds or thousands of jobs:
|
|
261
|
+
|
|
262
|
+
- Use event filtering to reduce message volume
|
|
263
|
+
- Consider using queues instead of topics if you don't need broadcast
|
|
264
|
+
- Increase heartbeat intervals if network latency is high
|
|
265
|
+
- Monitor broker memory usage and adjust configuration as needed
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Snakemake Logger Plugin for STOMP
|
|
2
|
+
|
|
3
|
+
Stream Snakemake workflow events to STOMP message brokers (ActiveMQ, RabbitMQ, Apollo) in real-time for monitoring, audit trails, and event-driven system integration.
|
|
4
|
+
|
|
5
|
+
## Key Features
|
|
6
|
+
|
|
7
|
+
- **Real-time event streaming** to STOMP-compatible message brokers
|
|
8
|
+
- **SSL/TLS encryption** for secure production deployments
|
|
9
|
+
- **Flexible formatters** - default flat JSON or JLab Scientific Workflow schema
|
|
10
|
+
- **Event filtering** - include/exclude specific event types to reduce noise
|
|
11
|
+
- **Custom formatters** - plugin your own formatter classes
|
|
12
|
+
- **Environment variable support** for credentials and sensitive configuration
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install snakemake-logger-plugin-stomp
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
### Command Line
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
snakemake --logger-plugin stomp \
|
|
26
|
+
--stomp-host localhost \
|
|
27
|
+
--stomp-port 61613 \
|
|
28
|
+
--stomp-user admin \
|
|
29
|
+
--stomp-password admin
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Profile Configuration
|
|
33
|
+
|
|
34
|
+
```yaml
|
|
35
|
+
# profiles/stomp/config.yaml
|
|
36
|
+
logger:
|
|
37
|
+
stomp:
|
|
38
|
+
host: "activemq.example.com"
|
|
39
|
+
port: 61613
|
|
40
|
+
user: "${STOMP_USER}"
|
|
41
|
+
password: "${STOMP_PASSWORD}"
|
|
42
|
+
queue: "/topic/snakemake.events"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Then run:
|
|
46
|
+
```bash
|
|
47
|
+
snakemake --profile profiles/stomp
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Environment Variables
|
|
51
|
+
|
|
52
|
+
Secure credentials using environment variables:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
export SNAKEMAKE_LOGGER_STOMP_HOST=activemq.example.com
|
|
56
|
+
export SNAKEMAKE_LOGGER_STOMP_USER=admin
|
|
57
|
+
export SNAKEMAKE_LOGGER_STOMP_PASSWORD=secret
|
|
58
|
+
snakemake --logger-plugin stomp
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Use Cases
|
|
62
|
+
|
|
63
|
+
- **External monitoring** - Send workflow events to centralized monitoring systems
|
|
64
|
+
- **Audit trails** - Create permanent records of workflow execution in message queues
|
|
65
|
+
- **Event-driven automation** - Trigger downstream processes based on workflow events
|
|
66
|
+
- **Team dashboards** - Build real-time dashboards showing workflow status across teams
|
|
67
|
+
- **Integration** - Connect Snakemake to enterprise message bus architectures
|