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.5.tar.gz (4.2 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.5-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

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

Hashes for prefect-discord-0.0.5.tar.gz
Algorithm Hash digest
SHA256 00263c816d6222f66af61447afdf542c20e74b76f09e6a3ff841e6b14d2c2d26
MD5 b097dc0e74c95000277eda2461c04793
BLAKE2b-256 ea1caae78466aa2a86f2e78e7f97200ea969f9c1a44acdf8167c5c3bb42a9ba1

See more details on using hashes here.

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

Hashes for prefect_discord-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 897833c76ff2012ff7c9845b24f52d21d5a56bc690082334b6bfe63062148acb
MD5 f38c04805d01c4c43775c5ab8825574f
BLAKE2b-256 13d742a16aac6c77ffde17f82f8e097208d3dbeb0191a2778f01fd17ed4df55a

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