pipen-email 0.0.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.
@@ -0,0 +1,45 @@
1
+ name: CI
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+
7
+ build:
8
+ runs-on: ubuntu-latest
9
+ strategy:
10
+ matrix:
11
+ python-version: [3.9, "3.10", "3.11", "3.12"]
12
+
13
+ steps:
14
+ - uses: actions/checkout@v6
15
+ - name: Install uv
16
+ uses: astral-sh/setup-uv@v8.0.0
17
+ with:
18
+ python-version: ${{ matrix.python-version }}
19
+ - name: Install dependencies
20
+ run: uv sync --all-extras --all-groups
21
+ - name: Run Ruff
22
+ run: uv run ruff check pipen_email.py
23
+ - name: Run mypy
24
+ run: uv run mypy pipen_email.py
25
+ - name: Run tests
26
+ run: uv run pytest
27
+
28
+ deploy:
29
+ needs: build
30
+ runs-on: ubuntu-latest
31
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
32
+ strategy:
33
+ matrix:
34
+ python-version: ["3.12"]
35
+ steps:
36
+ - uses: actions/checkout@v6
37
+ - name: Install uv
38
+ uses: astral-sh/setup-uv@v8.0.0
39
+ with:
40
+ python-version: ${{ matrix.python-version }}
41
+ - name: Publish to PyPI
42
+ run: |
43
+ uv build
44
+ uv publish --username ${{ secrets.PYPI_USER }} --password ${{ secrets.PYPI_PASSWORD }}
45
+ if: success()
@@ -0,0 +1,137 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ env/
12
+ build/
13
+ develop-eggs/
14
+ dist/
15
+ downloads/
16
+ eggs/
17
+ .eggs/
18
+ lib/
19
+ lib64/
20
+ parts/
21
+ sdist/
22
+ var/
23
+ *.egg-info/
24
+ .installed.cfg
25
+ *.egg
26
+
27
+ # PyInstaller
28
+ # Usually these files are written by a python script from a template
29
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
30
+ *.manifest
31
+ *.spec
32
+
33
+ # Installer logs
34
+ pip-log.txt
35
+ pip-delete-this-directory.txt
36
+
37
+ # Unit test / coverage reports
38
+ htmlcov/
39
+ .tox/
40
+ .coverage
41
+ .coverage.*
42
+ .cache
43
+ nosetests.xml
44
+ coverage.xml
45
+ .coverage.xml
46
+ cov.xml
47
+ *,cover
48
+ .hypothesis/
49
+
50
+ # Translations
51
+ *.mo
52
+ *.pot
53
+
54
+ # Django stuff:
55
+ *.log
56
+ local_settings.py
57
+
58
+ # Flask stuff:
59
+ instance/
60
+ .webassets-cache
61
+
62
+ # Scrapy stuff:
63
+ .scrapy
64
+
65
+ # Sphinx documentation
66
+ docs/_build/
67
+
68
+ # PyBuilder
69
+ target/
70
+
71
+ # IPython Notebook
72
+ .ipynb_checkpoints
73
+
74
+ # pyenv
75
+ .python-version
76
+
77
+ # celery beat schedule file
78
+ celerybeat-schedule
79
+
80
+ # dotenv
81
+ .env
82
+
83
+ # virtualenv
84
+ venv/
85
+ ENV/
86
+
87
+ # Spyder project settings
88
+ .spyderproject
89
+
90
+ # Rope project settings
91
+ .ropeproject
92
+
93
+ # workdir/
94
+ node_modules/
95
+ _book/
96
+ .vscode
97
+ export/
98
+ # *.svg
99
+ *.dot
100
+ *.queue.txt
101
+ site/
102
+
103
+ # poetry
104
+ # poetry.lock
105
+
106
+ # backup files
107
+ *.bak
108
+
109
+ .history/
110
+ .xqute/
111
+ .pipen/
112
+ t-*.ipynb
113
+ *-output/
114
+
115
+ .history/
116
+ *_results/
117
+ myoutput/
118
+
119
+ .pipen*
120
+
121
+ docs/index.md
122
+ /tests/running/output/
123
+ /tests/running/intermediate/
124
+ /tests/running/data/prepared/
125
+ /tests/running/workdir
126
+ Rplots.pdf
127
+ /biopipen
128
+ # git bundles
129
+ *.bundle
130
+
131
+ CLAUDE.md
132
+ /example.toml
133
+ /run_mcp.sh
134
+ /VSCODE_MCP_SETUP.md
135
+ debug.ipynb
136
+ PLAN.md
137
+ .venv/
@@ -0,0 +1,263 @@
1
+ Metadata-Version: 2.4
2
+ Name: pipen-email
3
+ Version: 0.0.1
4
+ Summary: Email notifications for pipen pipelines on status changes.
5
+ Project-URL: Homepage, https://github.com/pwwang/pipen-email
6
+ Project-URL: Repository, https://github.com/pwwang/pipen-email
7
+ Author-email: pwwang <pwwang@pwwang.com>
8
+ License: MIT
9
+ Requires-Python: >=3.9
10
+ Requires-Dist: pipen>=1.1
11
+ Provides-Extra: dev
12
+ Requires-Dist: aiosmtpd>=1.4.6; extra == 'dev'
13
+ Requires-Dist: mypy>=1.19.1; extra == 'dev'
14
+ Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
15
+ Requires-Dist: pytest-cov>=6; extra == 'dev'
16
+ Requires-Dist: pytest>=8; extra == 'dev'
17
+ Requires-Dist: ruff>=0.16.1; extra == 'dev'
18
+ Description-Content-Type: text/markdown
19
+
20
+ <div align="center">
21
+ <img src="pipen-email.png" width="300" alt="pipen-email logo" />
22
+ <p>Email notifications for <a href="https://github.com/pwwang/pipen">pipen</a> pipelines on status changes.
23
+ <br />
24
+ Uses Python stdlib `smtplib` + `email.message` — zero additional dependencies beyond `pipen`.
25
+ </p>
26
+ </div>
27
+
28
+ ## Installation
29
+
30
+ ```bash
31
+ pip install pipen-email
32
+ ```
33
+
34
+ ## Quickstart
35
+
36
+ ```python
37
+ from pipen import Pipen, Proc
38
+
39
+ class SayHello(Proc):
40
+ input = "name:var"
41
+ output = "outfile:file:greeting.txt"
42
+ script = 'echo "Hello, {{in.name}}!" > {{out.outfile}}'
43
+
44
+ pipeline = Pipen(
45
+ name="my-pipeline",
46
+ loglevel="debug",
47
+ plugin_opts={
48
+ # SMTP — email_host is required for any notifications to fire
49
+ "email_host": "smtp.example.com",
50
+ "email_port": 587,
51
+ "email_use_tls": True,
52
+ "email_username": "user",
53
+ "email_password": "pass",
54
+ # Envelope
55
+ "email_to": "you@example.com",
56
+ # Job digest (opt-in)
57
+ "email_on_job": True,
58
+ "email_batch_interval": 60,
59
+ },
60
+ )
61
+ pipeline.set_start(SayHello).set_data(["Alice", "Bob"]).run()
62
+ ```
63
+
64
+ > **Note:** `email_host` **must** be set to a truthy value. Without it, no emails will be sent — all notification keys are silently ignored. This acts as a master switch so you can disable the plugin entirely by omitting `email_host`.
65
+
66
+ ## SMTP Examples
67
+
68
+ ### Local debug server
69
+
70
+ ```bash
71
+ # Terminal 1 — start a debug SMTP server
72
+ python -m aiosmtpd -n -l localhost:1025
73
+
74
+ # Terminal 2 — run the pipeline
75
+ python my_pipeline.py
76
+ ```
77
+
78
+ ```python
79
+ plugin_opts = {
80
+ "email_host": "localhost",
81
+ "email_port": 1025,
82
+ "email_to": "dev@localhost",
83
+ }
84
+ ```
85
+
86
+ ### Gmail (with App Password)
87
+
88
+ Generate an app password at [myaccount.google.com/apppasswords](https://myaccount.google.com/apppasswords).
89
+
90
+ ```python
91
+ plugin_opts = {
92
+ "email_host": "smtp.gmail.com",
93
+ "email_port": 587,
94
+ "email_use_tls": True,
95
+ "email_username": "you@gmail.com",
96
+ "email_password": "your-16-char-app-password",
97
+ "email_to": "you@gmail.com",
98
+ }
99
+ ```
100
+
101
+ ### No-auth relay
102
+
103
+ ```python
104
+ plugin_opts = {
105
+ "email_host": "smtp-relay.internal",
106
+ "email_port": 25,
107
+ "email_to": "team@example.com",
108
+ }
109
+ ```
110
+
111
+ ### AWS SES
112
+
113
+ ```python
114
+ plugin_opts = {
115
+ "email_host": "email-smtp.us-east-1.amazonaws.com",
116
+ "email_port": 587,
117
+ "email_use_tls": True,
118
+ "email_username": "AKIA...",
119
+ "email_password": "your-ses-smtp-password",
120
+ "email_to": "team@example.com",
121
+ }
122
+ ```
123
+
124
+ ## Configuration Reference
125
+
126
+ All options live in `pipen.config.plugin_opts`. Set them via `Pipen(plugin_opts={...})`, `.pipen.toml`, or per-process `Proc.plugin_opts`.
127
+
128
+ ### SMTP connection
129
+
130
+ | Key | Default | Description |
131
+ | ---------------- | ------- | ------------------------------------------------------------- |
132
+ | `email_host` | `None` | SMTP server hostname. **Must** be set for any emails to send. |
133
+ | `email_port` | `25` | SMTP server port |
134
+ | `email_use_tls` | `False` | Use STARTTLS on connect |
135
+ | `email_use_ssl` | `False` | Use SMTPS (SSL on port 465) |
136
+ | `email_username` | `None` | SMTP auth username |
137
+ | `email_password` | `None` | SMTP auth password |
138
+ | `email_timeout` | `30` | SMTP connection timeout in seconds |
139
+
140
+ ### Email envelope
141
+
142
+ | Key | Default | Description |
143
+ | ---------------------- | ------------------- | ------------------------------------------------ |
144
+ | `email_from` | `"pipen@localhost"` | From address |
145
+ | `email_to` | `None` | To address(es) — comma-separated string or list |
146
+ | `email_cc` | `None` | CC address(es) — comma-separated string or list |
147
+ | `email_bcc` | `None` | BCC address(es) — comma-separated string or list |
148
+ | `email_subject_prefix` | `"[pipen]"` | Prefix prepended to every subject line |
149
+
150
+ ### Pipeline lifecycle
151
+
152
+ | Key | Default | Description |
153
+ | ------------------- | ------- | ------------------------------------------------------ |
154
+ | `email_on_start` | `True` | Send email when pipeline starts |
155
+ | `email_on_complete` | `True` | Send email when pipeline finishes (success or failure) |
156
+
157
+ ### Process lifecycle
158
+
159
+ | Key | Default | Description |
160
+ | ------------------------ | ------- | -------------------------------------------------------------------- |
161
+ | `email_on_proc_start` | `True` | Send email when a process starts |
162
+ | `email_on_proc_done` | `True` | Send email when a process completes, fails, or returns cached |
163
+ | `email_on_proc_shutdown` | `True` | Send email when a process receives a signal (SIGTERM, SIGKILL, etc.) |
164
+
165
+ > **Note:** `email_on_proc_done` covers all terminal statuses — completed, failed, and cached. There is no separate `email_on_proc_failed` toggle. When a process fails, the email body includes the failed job's script path, stdout/stderr file paths, and full stderr content.
166
+
167
+ ### Job lifecycle
168
+
169
+ | Key | Default | Description |
170
+ | ---------------------- | ------- | ----------------------------------------- |
171
+ | `email_on_job` | `False` | Enable batched job status digest emails |
172
+ | `email_batch_interval` | `60` | Minimum seconds between job digest emails |
173
+
174
+ ### Logging
175
+
176
+ | Key | Default | Description |
177
+ | ---------------- | -------- | ----------------------------------------------------------------------------------------------------------------------- |
178
+ | `email_loglevel` | `"info"` | Log level for email send events. One of `"debug"`, `"info"`, `"warning"`, `"error"`, or `"critical"`. Case-insensitive. |
179
+
180
+ ## How It Works
181
+
182
+ ### Email guard
183
+
184
+ All hooks check `email_host` first via the internal `_should_send` method. If `email_host` is not set (or falsy), every notification silently skips. This means you can conditionally enable the plugin:
185
+
186
+ ```python
187
+ # Disable in dev, enable in CI
188
+ plugin_opts = {
189
+ "email_host": "smtp.example.com" if os.environ.get("CI") else None,
190
+ "email_to": "team@example.com",
191
+ }
192
+ ```
193
+
194
+ ### Pipeline emails
195
+
196
+ Sent on `on_start` and `on_complete`. Body format:
197
+
198
+ ```
199
+ Pipeline: my-pipeline
200
+ Status: COMPLETED
201
+ Workdir: .pipen/my-pipeline
202
+ Outdir: /output/path
203
+ Processes: 3
204
+ Process names: ProcA, ProcB, ProcC
205
+ ```
206
+
207
+ ### Process emails
208
+
209
+ Sent on `on_proc_start`, `on_proc_done`, and `on_proc_shutdown`. Body format:
210
+
211
+ ```
212
+ Pipeline: my-pipeline
213
+ Process: ProcA
214
+ Status: COMPLETED
215
+ Jobs: 10
216
+ Workdir: .pipen/my-pipeline/ProcA
217
+
218
+ Job status summary:
219
+ INIT: 0-9
220
+ SUCCEEDED: 0-9
221
+ ```
222
+
223
+ On process failure, the body also includes details about the first failed job:
224
+
225
+ ```
226
+ Information for job #3:
227
+ - script: .pipen/my-pipeline/ProcA/3/job.script
228
+ - stdout: .pipen/my-pipeline/ProcA/3/job.stdout
229
+ - stderr: .pipen/my-pipeline/ProcA/3/job.stderr
230
+
231
+ Full STDERR:
232
+ ----------------
233
+ Traceback (most recent call last):
234
+ ...
235
+ ```
236
+
237
+ ### Job digest emails
238
+
239
+ When `email_on_job` is `True`, each job lifecycle event records its index. A digest email is sent when `email_batch_interval` seconds have elapsed since the last digest. Digest body format:
240
+
241
+ ```
242
+ Job status digest:
243
+ ---------------------
244
+ INIT: 0-9
245
+ RUNNING: 0-9
246
+ SUCCEEDED: 0-2
247
+ FAILED: 3-5
248
+ ```
249
+
250
+ Job digest emails are also flushed automatically in `on_proc_done` (via the interval gate).
251
+
252
+ ### Shutdown email
253
+
254
+ Only sent when the process receives an actual signal (`sig` is truthy). For normal process completion, `on_proc_shutdown` is called with `sig=None` and no email is sent — the `on_proc_done` email covers that case.
255
+
256
+ ## Error Handling
257
+
258
+ SMTP errors are caught and logged at `ERROR` level. The pipeline **never** fails due to an email error — `_send_email` returns `False` on failure, and the caller continues.
259
+
260
+ ## See Also
261
+
262
+ - [pipen](https://github.com/pwwang/pipen) — pipeline framework
263
+ - [example.py](example.py) — runnable smoke test
@@ -0,0 +1,244 @@
1
+ <div align="center">
2
+ <img src="pipen-email.png" width="300" alt="pipen-email logo" />
3
+ <p>Email notifications for <a href="https://github.com/pwwang/pipen">pipen</a> pipelines on status changes.
4
+ <br />
5
+ Uses Python stdlib `smtplib` + `email.message` — zero additional dependencies beyond `pipen`.
6
+ </p>
7
+ </div>
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ pip install pipen-email
13
+ ```
14
+
15
+ ## Quickstart
16
+
17
+ ```python
18
+ from pipen import Pipen, Proc
19
+
20
+ class SayHello(Proc):
21
+ input = "name:var"
22
+ output = "outfile:file:greeting.txt"
23
+ script = 'echo "Hello, {{in.name}}!" > {{out.outfile}}'
24
+
25
+ pipeline = Pipen(
26
+ name="my-pipeline",
27
+ loglevel="debug",
28
+ plugin_opts={
29
+ # SMTP — email_host is required for any notifications to fire
30
+ "email_host": "smtp.example.com",
31
+ "email_port": 587,
32
+ "email_use_tls": True,
33
+ "email_username": "user",
34
+ "email_password": "pass",
35
+ # Envelope
36
+ "email_to": "you@example.com",
37
+ # Job digest (opt-in)
38
+ "email_on_job": True,
39
+ "email_batch_interval": 60,
40
+ },
41
+ )
42
+ pipeline.set_start(SayHello).set_data(["Alice", "Bob"]).run()
43
+ ```
44
+
45
+ > **Note:** `email_host` **must** be set to a truthy value. Without it, no emails will be sent — all notification keys are silently ignored. This acts as a master switch so you can disable the plugin entirely by omitting `email_host`.
46
+
47
+ ## SMTP Examples
48
+
49
+ ### Local debug server
50
+
51
+ ```bash
52
+ # Terminal 1 — start a debug SMTP server
53
+ python -m aiosmtpd -n -l localhost:1025
54
+
55
+ # Terminal 2 — run the pipeline
56
+ python my_pipeline.py
57
+ ```
58
+
59
+ ```python
60
+ plugin_opts = {
61
+ "email_host": "localhost",
62
+ "email_port": 1025,
63
+ "email_to": "dev@localhost",
64
+ }
65
+ ```
66
+
67
+ ### Gmail (with App Password)
68
+
69
+ Generate an app password at [myaccount.google.com/apppasswords](https://myaccount.google.com/apppasswords).
70
+
71
+ ```python
72
+ plugin_opts = {
73
+ "email_host": "smtp.gmail.com",
74
+ "email_port": 587,
75
+ "email_use_tls": True,
76
+ "email_username": "you@gmail.com",
77
+ "email_password": "your-16-char-app-password",
78
+ "email_to": "you@gmail.com",
79
+ }
80
+ ```
81
+
82
+ ### No-auth relay
83
+
84
+ ```python
85
+ plugin_opts = {
86
+ "email_host": "smtp-relay.internal",
87
+ "email_port": 25,
88
+ "email_to": "team@example.com",
89
+ }
90
+ ```
91
+
92
+ ### AWS SES
93
+
94
+ ```python
95
+ plugin_opts = {
96
+ "email_host": "email-smtp.us-east-1.amazonaws.com",
97
+ "email_port": 587,
98
+ "email_use_tls": True,
99
+ "email_username": "AKIA...",
100
+ "email_password": "your-ses-smtp-password",
101
+ "email_to": "team@example.com",
102
+ }
103
+ ```
104
+
105
+ ## Configuration Reference
106
+
107
+ All options live in `pipen.config.plugin_opts`. Set them via `Pipen(plugin_opts={...})`, `.pipen.toml`, or per-process `Proc.plugin_opts`.
108
+
109
+ ### SMTP connection
110
+
111
+ | Key | Default | Description |
112
+ | ---------------- | ------- | ------------------------------------------------------------- |
113
+ | `email_host` | `None` | SMTP server hostname. **Must** be set for any emails to send. |
114
+ | `email_port` | `25` | SMTP server port |
115
+ | `email_use_tls` | `False` | Use STARTTLS on connect |
116
+ | `email_use_ssl` | `False` | Use SMTPS (SSL on port 465) |
117
+ | `email_username` | `None` | SMTP auth username |
118
+ | `email_password` | `None` | SMTP auth password |
119
+ | `email_timeout` | `30` | SMTP connection timeout in seconds |
120
+
121
+ ### Email envelope
122
+
123
+ | Key | Default | Description |
124
+ | ---------------------- | ------------------- | ------------------------------------------------ |
125
+ | `email_from` | `"pipen@localhost"` | From address |
126
+ | `email_to` | `None` | To address(es) — comma-separated string or list |
127
+ | `email_cc` | `None` | CC address(es) — comma-separated string or list |
128
+ | `email_bcc` | `None` | BCC address(es) — comma-separated string or list |
129
+ | `email_subject_prefix` | `"[pipen]"` | Prefix prepended to every subject line |
130
+
131
+ ### Pipeline lifecycle
132
+
133
+ | Key | Default | Description |
134
+ | ------------------- | ------- | ------------------------------------------------------ |
135
+ | `email_on_start` | `True` | Send email when pipeline starts |
136
+ | `email_on_complete` | `True` | Send email when pipeline finishes (success or failure) |
137
+
138
+ ### Process lifecycle
139
+
140
+ | Key | Default | Description |
141
+ | ------------------------ | ------- | -------------------------------------------------------------------- |
142
+ | `email_on_proc_start` | `True` | Send email when a process starts |
143
+ | `email_on_proc_done` | `True` | Send email when a process completes, fails, or returns cached |
144
+ | `email_on_proc_shutdown` | `True` | Send email when a process receives a signal (SIGTERM, SIGKILL, etc.) |
145
+
146
+ > **Note:** `email_on_proc_done` covers all terminal statuses — completed, failed, and cached. There is no separate `email_on_proc_failed` toggle. When a process fails, the email body includes the failed job's script path, stdout/stderr file paths, and full stderr content.
147
+
148
+ ### Job lifecycle
149
+
150
+ | Key | Default | Description |
151
+ | ---------------------- | ------- | ----------------------------------------- |
152
+ | `email_on_job` | `False` | Enable batched job status digest emails |
153
+ | `email_batch_interval` | `60` | Minimum seconds between job digest emails |
154
+
155
+ ### Logging
156
+
157
+ | Key | Default | Description |
158
+ | ---------------- | -------- | ----------------------------------------------------------------------------------------------------------------------- |
159
+ | `email_loglevel` | `"info"` | Log level for email send events. One of `"debug"`, `"info"`, `"warning"`, `"error"`, or `"critical"`. Case-insensitive. |
160
+
161
+ ## How It Works
162
+
163
+ ### Email guard
164
+
165
+ All hooks check `email_host` first via the internal `_should_send` method. If `email_host` is not set (or falsy), every notification silently skips. This means you can conditionally enable the plugin:
166
+
167
+ ```python
168
+ # Disable in dev, enable in CI
169
+ plugin_opts = {
170
+ "email_host": "smtp.example.com" if os.environ.get("CI") else None,
171
+ "email_to": "team@example.com",
172
+ }
173
+ ```
174
+
175
+ ### Pipeline emails
176
+
177
+ Sent on `on_start` and `on_complete`. Body format:
178
+
179
+ ```
180
+ Pipeline: my-pipeline
181
+ Status: COMPLETED
182
+ Workdir: .pipen/my-pipeline
183
+ Outdir: /output/path
184
+ Processes: 3
185
+ Process names: ProcA, ProcB, ProcC
186
+ ```
187
+
188
+ ### Process emails
189
+
190
+ Sent on `on_proc_start`, `on_proc_done`, and `on_proc_shutdown`. Body format:
191
+
192
+ ```
193
+ Pipeline: my-pipeline
194
+ Process: ProcA
195
+ Status: COMPLETED
196
+ Jobs: 10
197
+ Workdir: .pipen/my-pipeline/ProcA
198
+
199
+ Job status summary:
200
+ INIT: 0-9
201
+ SUCCEEDED: 0-9
202
+ ```
203
+
204
+ On process failure, the body also includes details about the first failed job:
205
+
206
+ ```
207
+ Information for job #3:
208
+ - script: .pipen/my-pipeline/ProcA/3/job.script
209
+ - stdout: .pipen/my-pipeline/ProcA/3/job.stdout
210
+ - stderr: .pipen/my-pipeline/ProcA/3/job.stderr
211
+
212
+ Full STDERR:
213
+ ----------------
214
+ Traceback (most recent call last):
215
+ ...
216
+ ```
217
+
218
+ ### Job digest emails
219
+
220
+ When `email_on_job` is `True`, each job lifecycle event records its index. A digest email is sent when `email_batch_interval` seconds have elapsed since the last digest. Digest body format:
221
+
222
+ ```
223
+ Job status digest:
224
+ ---------------------
225
+ INIT: 0-9
226
+ RUNNING: 0-9
227
+ SUCCEEDED: 0-2
228
+ FAILED: 3-5
229
+ ```
230
+
231
+ Job digest emails are also flushed automatically in `on_proc_done` (via the interval gate).
232
+
233
+ ### Shutdown email
234
+
235
+ Only sent when the process receives an actual signal (`sig` is truthy). For normal process completion, `on_proc_shutdown` is called with `sig=None` and no email is sent — the `on_proc_done` email covers that case.
236
+
237
+ ## Error Handling
238
+
239
+ SMTP errors are caught and logged at `ERROR` level. The pipeline **never** fails due to an email error — `_send_email` returns `False` on failure, and the caller continues.
240
+
241
+ ## See Also
242
+
243
+ - [pipen](https://github.com/pwwang/pipen) — pipeline framework
244
+ - [example.py](example.py) — runnable smoke test