Skip to main content

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 State classes to ignore, e.g., [Running, Scheduled]. If new_state is 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 of State classes
  • 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): dict with "http" and/or "https" keys, passed to requests.post - for situations where a proxy is required to send requests to the Discrd webhook

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prefect-discord-0.0.6.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prefect_discord-0.0.6-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file prefect-discord-0.0.6.tar.gz.

File metadata

  • Download URL: prefect-discord-0.0.6.tar.gz
  • Upload date:
  • Size: 4.3 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

Hashes for prefect-discord-0.0.6.tar.gz
Algorithm Hash digest
SHA256 6d997c4a16e6d116e1b34cdf35a0efc0c96059251c3959ae73e49256d8a98656
MD5 46608aadd3441173c6bba5477a88bed7
BLAKE2b-256 31464e9e8a233aed5cc7e14e71319d564790ccb5095494e8cb0fba7058796a35

See more details on using hashes here.

File details

Details for the file prefect_discord-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: prefect_discord-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 5.0 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

Hashes for prefect_discord-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 e3c77deae239a88ac1e63970774bb589d05fc8ed1bb36b76874157d4dca4f8d1
MD5 bcb2221f9293f1fc46243c8b678d67d2
BLAKE2b-256 58a5eebf7f21339dc54f6bfa66b0131e23b846089d465358977ce238188aa993

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page