Skip to main content

Apache Airflow Mattermost provider

Project description

Apache Airflow Mattermost Provider

GitHub branch check runs Read the Docs (version) PyPI - Version

The package is Apache Airflow provider for integrating with Mattermost using webhooks

Features

  • Hook
  • Operator
  • Notifier

Hook

Provides custom connection type and sends messages via webhook

connection

Operator

To send messages within DAGs, supports templating

from airflow.decorators import dag

from airflow_providers_mattermost.operators import MattermostOperator


@dag(
    dag_id='mattermost_dag'
)
def mattermost():
    send_message_to_mattermost = MattermostOperator(
        task_id='send_message_to_mattermost',
        conn_id='mattermost',
        channel='off-topic',
        message='Hello from {{ dag.dag_id }} in Airflow!',
        username='Airflow',
    )

    send_message_to_mattermost


mattermost()

Notifier

Can be used with on_*_callbacks to notify about Task/DAG status

from airflow.decorators import dag

from airflow_providers_mattermost.notifiers import MattermostNotifier
from airflow_providers_mattermost.operators import MattermostOperator


@dag(
    dag_id='mattermost_dag',
    on_success_callback=MattermostNotifier(
        conn_id='mattermost',
        channel='off-topic',
        message='Dag ID: {{ dag.dag_id }} , Run ID: {{ run_id }} has completed',
        username='Airflow',
    ),
    on_failure_callback=MattermostNotifier(
        conn_id='mattermost',
        channel='off-topic',
        message='Dag ID: {{ dag.dag_id }} , Run ID: {{ run_id }} has failed',
        username='Airflow',
    ),
)
def mattermost():
    send_message_to_mattermost = MattermostOperator(
        task_id='send_message_to_mattermost',
        conn_id='mattermost',
        channel='off-topic',
        message='Hello from {{ dag.dag_id }} in Airflow!',
        username='Airflow',
    )

    send_message_to_mattermost


mattermost()

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

airflow_providers_mattermost-0.3.0.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

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

airflow_providers_mattermost-0.3.0-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file airflow_providers_mattermost-0.3.0.tar.gz.

File metadata

File hashes

Hashes for airflow_providers_mattermost-0.3.0.tar.gz
Algorithm Hash digest
SHA256 50d6910d02614fa6946160549f3675a5ccccfc252e4878d2792e4affb76a2a7b
MD5 ef2d4e9d59ec54ea9a7f183e4b8c577d
BLAKE2b-256 a88da7cd63e583de9a3d21cd40b42fc86910b18fd44dc644d20b4209105cccae

See more details on using hashes here.

File details

Details for the file airflow_providers_mattermost-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for airflow_providers_mattermost-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6d3b6f217b4f2903b712a18545be46effa990b80aced2085c827211cc90c49af
MD5 733dccd0de0d99d71930e3ab318a5f60
BLAKE2b-256 6c008b10d5b8f51eff830893841fa96ad06e952a16e28c41f6b5267440b76709

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