A simple package to send Prefect flows and tasks notifications to a Discord channel
Project description
Prefect Discord
Prefect Discord is a lightweight package to send notifications from flows and tasks to a Discord channel. The alerting system is configurable and allows many options that suit different flows and tasks.
Usage Example
from prefect import task
from prefect_discord import discord_notifier
@task(state_handlers=[discord_notifier(ignore_states=[Running])])
def add(x, y):
return x + y
Configuration
Environment Variables
prefect_discord expects a few secrets set on Prefect's config.toml:
DISCORD_WEBHOOK_URL= "discord_channel_webhook_url"DISCORD_WEBHOOK_THUMBNAIL_URL= "url_for_the_main_image"DISCORD_WEBHOOK_FOOTER_MESSAGE= "footer_text_next_to_icon"DISCORD_WEBHOOK_FOOTER_ICON_URL= "url_for_the_footer_image"
State Handler Parameters
The state handler can also be configured with some options
- ignore_states ([State], optional): list of
Stateclasses to ignore, e.g.,[Running, Scheduled]. Ifnew_stateis an instance of one of the passed states, no notification will occur. - only_states ([State], optional): similar to
ignore_states, but instead only notifies you if the Task / Flow is in a state from the provided list ofStateclasses - webhook_secret (str, optional): the name of the Prefect Secret that stores your Discord
webhook URL; defaults to
"DISCORD_WEBHOOK_URL" - backend_info (bool, optional): Whether to supply the Discord notification with urls pointing to backend pages; defaults to True
- proxies (dict), optional):
dictwith "http" and/or "https" keys, passed torequests.post- for situations where a proxy is required to send requests to the Discrd webhook
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file prefect-discord-0.0.5.tar.gz.
File metadata
- Download URL: prefect-discord-0.0.5.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00263c816d6222f66af61447afdf542c20e74b76f09e6a3ff841e6b14d2c2d26
|
|
| MD5 |
b097dc0e74c95000277eda2461c04793
|
|
| BLAKE2b-256 |
ea1caae78466aa2a86f2e78e7f97200ea969f9c1a44acdf8167c5c3bb42a9ba1
|
File details
Details for the file prefect_discord-0.0.5-py3-none-any.whl.
File metadata
- Download URL: prefect_discord-0.0.5-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
897833c76ff2012ff7c9845b24f52d21d5a56bc690082334b6bfe63062148acb
|
|
| MD5 |
f38c04805d01c4c43775c5ab8825574f
|
|
| BLAKE2b-256 |
13d742a16aac6c77ffde17f82f8e097208d3dbeb0191a2778f01fd17ed4df55a
|