Hey everyone, quick question about the `jira_notif...
# data-tricks-and-tips
f
Hey everyone, quick question about the
jira_notifier
. I'm trying to set up a Jira Notification which is triggered whenever a task fails:
Copy code
from prefect import task
    from prefect.utilities.notifications.jira_notification import jira_notifier

    @task(state_handlers=[
        jira_notifier(
            only_states=[Failed],
            options={'project': 'TEST', 'issuetype': {'name': 'Bug'}},
            assignee='tester'
        )
    ])
    def add(x, y):
        return x + y
However I'm getting the following error:
Copy code
Failed to load and execute flow run: NameError("name 'Failed' is not defined")
Is there an import for States or something like this? Or am I missing something else?
1
s
Hi ! Assuming we're talking about Prefect 1.X, you can import with
from prefect.engine.state import Failed
🙌 2
🙏 2
🙏 2
1
f
That's what I was looking for, thanks! 🙂
s
My pleasure ! Happy engineering 🙂