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.4.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.4-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: prefect-discord-0.0.4.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.4.tar.gz
Algorithm Hash digest
SHA256 a76cfae5688554c6cb7d19fd72bb182c905b47eaa77d22d1653b4f5983c8095f
MD5 c0f1e85457a498c5a57c510b13c802d1
BLAKE2b-256 cb0d6e4f10dc042a1a0dcfe8460026c4dcd88751a56a1f893949d295d8a2185b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: prefect_discord-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 5.1 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0cd5031120c303270b18d94bb0649a38d3b3d3656e32e4b9608420a9fb97be11
MD5 9747130bf1c7acd90c6546a64cefbd55
BLAKE2b-256 f381e1bacfa591190e3c03f200d8795d1c05238c971653643868f910a6c2da2c

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