Skip to content

Conversation

@amoghrajesh
Copy link
Contributor

Extracted out of: #54083, to fix:

______________________________________________________________________________ TestEmailSmtp.test_send_mime_airflow_config _______________________________________________________________________________
airflow-core/tests/unit/utils/test_email.py:218: in test_send_mime_airflow_config
    email.send_mime_email("from", "to", msg, dryrun=False)
airflow-core/src/airflow/utils/email.py:251: in send_mime_email
    airflow_conn = BaseHook.get_connection(conn_id)
task-sdk/src/airflow/sdk/bases/hook.py:63: in get_connection
    conn = Connection.get(conn_id)
task-sdk/src/airflow/sdk/definitions/connection.py:154: in get
    return _get_connection(conn_id)
task-sdk/src/airflow/sdk/execution_time/context.py:153: in _get_connection
    from airflow.sdk.execution_time.task_runner import SUPERVISOR_COMMS
E   ImportError: cannot import name 'SUPERVISOR_COMMS' from 'airflow.sdk.execution_time.task_runner' (/opt/airflow/task-sdk/src/airflow/sdk/execution_time/task_runner.py)

The core email functionality has no reason to use BaseHook (from sdk). Swapping to use connection models. This will cut the link between sdk and core too.

Extracted out of #54083


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@amoghrajesh amoghrajesh requested review from ashb, eladkal and kaxil August 4, 2025 09:44
@amoghrajesh amoghrajesh self-assigned this Aug 4, 2025
@amoghrajesh amoghrajesh added this to the Airflow 3.1.0 milestone Aug 4, 2025
@amoghrajesh amoghrajesh changed the title Swap send_mime_email to use Connection instead of BaseHook Swap send_mime_email in core to use Connection instead of BaseHook Aug 4, 2025
@amoghrajesh amoghrajesh merged commit e603cd8 into apache:main Aug 4, 2025
57 checks passed
@amoghrajesh amoghrajesh deleted the use-models-connection-for-email branch August 4, 2025 11:11
ferruzzi pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Aug 7, 2025
fweilun pushed a commit to fweilun/airflow that referenced this pull request Aug 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants