Skip to content

ModuleNotFoundError: No module named 'airflow.sdk.definitions.notifier' when using a custom notifier #50620

@jnstockley

Description

@jnstockley

Apache Airflow version

3.0.1

If "Other Airflow 2 version" selected, which one?

No response

What happened?

When I create a custom notifier using a similar example that is shown in the docs, I see this error

Traceback (most recent call last):
  File "/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/__init__.py", line 121, in __getattr__
    mod = importlib.import_module(module_path, __name__)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'airflow.sdk.definitions.notifier'

What you think should happen instead?

There should be no error and the notifier should work when using on_*_callback

How to reproduce

Create a custom notifier and a DAG using any of the on_*_callback parameters

Operating System

Linux

Versions of Apache Airflow Providers

Tried both
apache-airflow-providers-common-compat==1.7.0rc1 and
apache-airflow-providers-common-compat==1.6.1

Deployment

Other Docker-based deployment

Deployment details

Custom Docker image

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:coreduplicateIssue that is duplicatedkind:bugThis is a clearly a bugneeds-triagelabel for new issues that we didn't triage yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions