Raj
Raj

Reputation: 623

Airflow - Slack notification. I'm trying to configure slack notification when my program fails using airflow

When I run the program, I receive a "broken dag no named module slackclient". I checked my code and setup my slack account.

I had included the necessary packages as well

from slackclient import SlackClient
from airflow.operators.slack_operator import SlackAPIPostOperator

failed_alert = SlackAPIPostOperator(
         task_id='shdfs',
         channel="#data",
         token="shdfgsdjh324353243brsrbewr3243",
         user= 'usr',
         text = "hi,this is notification"  )

Am I missing something? please let me know. Thanks in advance!

Upvotes: 2

Views: 2313

Answers (2)

mohan pilla
mohan pilla

Reputation: 1

Airflow was implemented with slackclient api version 'slackclient>=1.0.0,<2.0.0'.

from slackclient import SlackClient has been replaced with import slack in present slackclient version 2.5.0. Change your slackclient version to slackclient>=1.0.0,<2.0.0 using this :

pip install 'slackclient>=1.0.0,<2.0.0'

Upvotes: 0

kaxil
kaxil

Reputation: 18884

Run the following command and install slack dependencies and try again.

pip install apache-airflow[slack]

Upvotes: 3

Related Questions