Skip to main content

Python 3.7 PyPI version License: MIT Twitter Follow

Publish Airflow Notification to a SNS Topic

This package adds a callback function to use in failures to DAGs and Tasks in a Airflow project.

Installation

pip install airflow-notify-sns

Usage

from datetime import timedelta

# Airflow native imports to create a DAG
from airflow import DAG, utils
from airflow.operators.bash_operator import BashOperator

# Here is function import
from airflow_notify_sns import airflow_notify_sns

# Dag Definition
dag = DAG(
    dag_id='test_dag',
    default_args={
        'owner': 'airflow',
        'depends_on_past': False,
        'start_date': utils.dates.days_ago(1),
        'retries': 3,
        'retry_delay': timedelta(minutes=5)
    },
    schedule_interval="@daily",
    dagrun_timeout=timedelta(minutes=60),
    sla_miss_callback=airflow_notify_sns,
    on_failure_callback=airflow_notify_sns
)

# Add your tasks here
t = BashOperator(
    dag=dag,
    task_id='test_env',
    bash_command='/tmp/test.sh',
    env={'EXECUTION_DATE': '{{ ds }}'},
    on_failure_callback=airflow_notify_sns
)

When DAG or tasks ends in error, a notification will be send to a SNS Topic using AWS default connection (aws_default).

Required Variable

This module will try to find a variable named airflow_notify_sns_arn in your Airflow environment, containing SNS Topic ARN where message will be published to.

If variable is not found, function will abort execution with no error.

Metadata

Release files for airflow-notify-sns 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for airflow-notify-sns 0.0.2
File Size Uploaded Provenance Actions
airflow-notify-sns-0.0.2.tar.gz 2.9 kB Without provenance Details for airflow-notify-sns-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for airflow-notify-sns 0.0.2
File Interpreter ABI Platform Actions
airflow_notify_sns-0.0.2-py3-none-any.whl Python 3 none any Details for airflow_notify_sns-0.0.2-py3-none-any.whl

Total release size: 7.1 kB

Release files / airflow-notify-sns-0.0.2.tar.gz

Download URL airflow-notify-sns-0.0.2.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
32217d2425152c0a3e308dcf06dedb86c6b1758fc4841474f44c54b8bc69a5e5
BLAKE2b-256 checksum
How to use checksums
d013ba16b7619c2e725120ff4798920e0c64e57babbbbc28ca3715b83adefe01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.23.0 setuptools/51.1.2.post20210112 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

Release files / airflow_notify_sns-0.0.2-py3-none-any.whl

Download URL airflow_notify_sns-0.0.2-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c73ce82e5967f0a8ba0deef0a593a1ba98bfcd8367e289e15722a85778f148c9
BLAKE2b-256 checksum
How to use checksums
347dd84e32c89b729c6eed9932d516fa659ae3efc3fecb6ddf0e588a625113fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.23.0 setuptools/51.1.2.post20210112 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

Security for airflow-notify-sns 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page