refactor!: configure email alerts via notification channels - #2
Merged
Merged
Conversation
…onfig Remove smtp_config and email_style from Task.__init__. log_path remains the only logging-related argument and is converted internally into a file channel; email alerts and any other notification channels are now configured via the channels parameter (list[NotificationChannel]), placed after dependencies and before timeout. EmailChannel is exported publicly as the way to attach email alerts. BREAKING CHANGE: Task no longer accepts smtp_config or email_style. Pass channels=[EmailChannel(smtp_config, style)] instead.
typing.Self (used in process.py) is only available from Python 3.11.
The exact round-to-4 check left no margin for runner overhead, causing intermittent failures on loaded CI runners.
Inline comments after each type were being treated as part of the allowed type strings, so no PR title type ever matched.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
NotificationChannel, an abstract base class for delivering task log/failure notifications. New channels (Slack, Discord, Telegram, etc.) can be added later by subclassing it, with no changes toTask._FileChannel(per-task log file) and a publicEmailChannel(HTML email alert on logging.ERROR+).Task.__init__no longer acceptssmtp_configoremail_style. log_path remains the only logging-related argument (converted internally to a_FileChannel). All other notification configuration — including email — is passed via the new channels:list[NotificationChannel] | None = Noneparameter (positioned after dependencies, before timeout)._frame_filter) is now sourced from aframe_filterproperty on each channel (e.g.EmailChannelderives it fromstyle.traced_vars_frame_filter), defaulting toNoneif no channel provides one.Why:
Email and file logging were hardcoded into Task, making it awkward to add new alerting destinations. This refactor establishes a clean extension point for future channels while keeping the per-task file log and HTML email alert behavior unchanged for users who migrate to
channels=[EmailChannel(...)].Migration:
Before
After
Type of change
feat— new featurefix— bug fixrefactor— no behavior changedocs— documentation onlytest— tests onlychore/ci/build