Skip to main content

Get notified when your Dagster runs succeed, fail, or change status across 70+ services including Slack, Discord, Pushover, Telegram, and more.

Project description

dagster-apprise

A dagster module that provides integration with Apprise for sending notifications across 70+ services including Slack, Discord, Pushover, Telegram, email, and more.

Installation

The dagster_apprise module is a PyPI package - use whichever python environment manager you'd prefer, although we default to using uv.

uv venv
source .venv/bin/activate
uv pip install dagster-apprise

Example Usage

import dagster as dg
from dagster_apprise import apprise_notifications, AppriseNotificationsConfig

# Configure notifications
config = AppriseNotificationsConfig(
    urls=["discord://webhook_id/webhook_token"], # Discord notification, details should be secure
    events=["SUCCESS", "FAILURE"],  # What to notify about
    include_jobs=["*"],  # All jobs
)

# Add to your Dagster definitions
defs = dg.Definitions(
    assets=[your_assets],
    jobs=[your_jobs],
    **apprise_notifications(config).to_dict()
)

Configuration Options

Full List

See the Apprise documentation for all supported services.

AppriseNotificationsConfig

Option Type Default Description
urls list[str] [] List of Apprise notification URLs
config_file str None Path to Apprise config file
base_url str None Base URL for Dagster UI links
title_prefix str "Dagster" Prefix for notification titles
events list[str] ["FAILURE"] Events to notify about
include_jobs list[str] ["*"] Job patterns to include
exclude_jobs list[str] [] Job patterns to exclude

Supported Events

  • SUCCESS: Job completed successfully
  • FAILURE: Job failed
  • CANCELED: Job was canceled
  • RUNNING: Job started running

Job Filtering

Use wildcard patterns to control which jobs trigger notifications:

config = AppriseNotificationsConfig(
    urls=["mailto://user:pass@gmail.com"],
    include_jobs=["prod_*", "critical_*"],  # Only production and critical jobs
    exclude_jobs=["*_test", "*_dev"],       # Exclude test and dev jobs
    events=["SUCCESS", "FAILURE"],
)

Advanced Usage

Op-level Notifications with Hooks

from dagster_apprise import apprise_on_failure, apprise_on_success
import dagster as dg

@apprise_on_failure(urls=["mailto://user:pass@gmail.com"])
@dg.job
def critical_job():
    my_op()

# Or apply to specific ops
@dg.job
def selective_notifications():
    my_op.with_hooks({apprise_on_failure(urls=["mailto://user:pass@gmail.com"])})()

Using AppriseResource in Ops

import dagster as dg
from dagster_apprise import AppriseResource

@dg.op
def notify_op(apprise: AppriseResource):
    apprise.notify(title="Custom Alert", body="processing complete")

Using with Environment Variables

import os
from dagster_apprise import AppriseNotificationsConfig

# Load from environment
config = AppriseNotificationsConfig(
    urls=[os.getenv("GMAIL_URL")],
    base_url=os.getenv("DAGSTER_BASE_URL", "http://localhost:3000"),
    events=["SUCCESS", "FAILURE"],
)

YAML Configuration

Create defs.yaml:

type: dagster_apprise.apprise_notifications
attributes:
  urls:
    - "pover://user@token"
    - "https://hooks.slack.com/services/YOUR/SLACK/WEBHOOK"
  base_url: "http://localhost:3000"
  events: ["SUCCESS", "FAILURE"]
  include_jobs: ["*"]
  exclude_jobs: ["*_test"]

Multiple Notification Channels

config = AppriseNotificationsConfig(
    urls=[
        "pover://user@token",  # Pushover for immediate testing alerts
        "https://hooks.slack.com/services/YOUR/SLACK/WEBHOOK",  # Slack for team
        "mailto://user:pass@gmail.com",  # Email for backup
    ],
    events=["SUCCESS", "FAILURE"],
)

Different Notifications for Different Jobs

# Critical jobs - notify on all events
critical_config = AppriseNotificationsConfig(
    urls=["mailto://user:pass@gmail.com"],
    include_jobs=["critical_*"],
    events=["SUCCESS", "FAILURE", "CANCELED", "RUNNING"],
)

# Regular jobs - only notify on failures
regular_config = AppriseNotificationsConfig(
    urls=["https://hooks.slack.com/services/YOUR/SLACK/WEBHOOK"],
    include_jobs=["*"],
    exclude_jobs=["critical_*"],
    events=["FAILURE"],
)

# Combine both
defs = dg.Definitions(
    assets=[your_assets],
    jobs=[your_jobs],
    resources={
        **apprise_notifications(critical_config).resources,
        **apprise_notifications(regular_config).resources,
    },
    sensors=[
        *apprise_notifications(critical_config).sensors,
        *apprise_notifications(regular_config).sensors,
    ],
)

Custom Run Failure Sensor

from dagster_apprise import make_apprise_on_run_failure_sensor

apprise_on_failure = make_apprise_on_run_failure_sensor(
    urls=["mailto://user:pass@gmail.com"],
    monitored_jobs=["prod_*"]
)

defs = dg.Definitions(sensors=[apprise_on_failure])

Integration with Dagster Logs

@dg.op
def my_op(context):
    context.log.info("This appears in Dagster logs")
    error_condition = False
    if error_condition:
        context.resources.apprise.notify(
            title="Critical Error",
            body=f"Job {context.job_name} encountered an error",
        )

Dagster+ Users

If you're using Dagster+, you already have built-in alerting for Slack, Microsoft Teams, PagerDuty, and email. For OSS users, try dagster-apprise for an alternative.

Notes on Base URL

  • You can set base_url or webserver_base_url (alias) to include deep links to runs in notifications.

Development

The Makefile provides the tools required to test and lint your local installation.

make test
make ruff
make check

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

dagster_apprise-0.0.3.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

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

dagster_apprise-0.0.3-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file dagster_apprise-0.0.3.tar.gz.

File metadata

  • Download URL: dagster_apprise-0.0.3.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for dagster_apprise-0.0.3.tar.gz
Algorithm Hash digest
SHA256 722637b2d23f830bd4f248cf3bbe1fae93c9c4420f4bfaffa537d75d9f197791
MD5 529593750edde16ae6cb02657e9e26d3
BLAKE2b-256 ce2d6aba982822dd4c97fd58872efe72af121ac59b0404076baaa1fca82306f2

See more details on using hashes here.

File details

Details for the file dagster_apprise-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: dagster_apprise-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for dagster_apprise-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1dfecd8325758af8cfad463c5863818591f7800aaec34849a211ab6853653462
MD5 3150bc6370d588df7d78bec4d20e0830
BLAKE2b-256 5207884e14d468402fd5a7a1bc36e126505ab5fc3fb53de8dc8db05811958cec

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