Skip to content

Conversation

@ramitkataria
Copy link
Contributor

@ramitkataria ramitkataria commented Mar 11, 2025

When a Task SDK connection is not found, it currently throws AirflowRuntimeError. This PR catches it in this case and raises AirflowNotFoundException for consistency.

Earlier, I was changing AwsGenericHook to also catch the AirflowRuntimeError but I was getting import errors in tests. Then I realized it's probably better if this error handling is done where it was being done previously.

After #47048, the boto fallback strategy started breaking in AwsGenericHook (explained in more detail here:
#47048 (comment)). I realized that this was because a new exception AirflowRuntimeError was introduced in BaseHook's get_connection. It used to only throw AirflowNotFoundException earlier.


^ 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 newsfragments.

@boring-cyborg boring-cyborg bot added area:providers provider:amazon AWS/Amazon - related issues labels Mar 11, 2025
@ramitkataria ramitkataria changed the title Handle BaseHook.get_connection's new Task SDK exception in AwsGenericHook Handle BaseHook.get_connection's new Task SDK exception Mar 12, 2025
@ramitkataria ramitkataria changed the title Handle BaseHook.get_connection's new Task SDK exception Handle BaseHook.get_connection's new Task SDK exception when connection is not found Mar 12, 2025
@amoghrajesh
Copy link
Contributor

@ramitkataria is this a duplicate of #47593?

@ramitkataria
Copy link
Contributor Author

@ramitkataria is this a duplicate of #47593?

I don't think so? It was still raising AirflowRuntimeException when a connection was not found

@amoghrajesh
Copy link
Contributor

@ramitkataria is this a duplicate of #47593?

I don't think so? It was still raising AirflowRuntimeException when a connection was not found

Yep, i noticed it. Thanks for your contribution @ramitkataria

@o-nikolas
Copy link
Contributor

@amoghrajesh Is all your feedback addressed? Does this look ready to approve?

@eladkal
Copy link
Contributor

eladkal commented Mar 23, 2025

Needs rebase and resolve conflicts

@ramitkataria ramitkataria force-pushed the ramitkataria/tasksdk-exception branch from ac7890c to a1bb15e Compare March 24, 2025 20:13
…en appropriate

When a Task SDK connection is not found, it currently throws AirflowRuntimeError. This catches it in this case and raises AirflowNotFoundException for consistency.
@ramitkataria ramitkataria force-pushed the ramitkataria/tasksdk-exception branch from a1bb15e to ee7d4d2 Compare March 24, 2025 20:23
@o-nikolas o-nikolas merged commit cc5b573 into apache:main Mar 24, 2025
44 checks passed
@o-nikolas o-nikolas deleted the ramitkataria/tasksdk-exception branch March 24, 2025 21:16
prabhusneha pushed a commit to astronomer/airflow that referenced this pull request Mar 25, 2025
…tion is not found (apache#47648)

When a Task SDK connection is not found, it currently throws AirflowRuntimeError. This PR catches it in this case and raises AirflowNotFoundException for consistency.
pankajkoti pushed a commit to astronomer/airflow that referenced this pull request Mar 28, 2025
…tion is not found (apache#47648)

When a Task SDK connection is not found, it currently throws AirflowRuntimeError. This PR catches it in this case and raises AirflowNotFoundException for consistency.
shubham-pyc pushed a commit to shubham-pyc/airflow that referenced this pull request Apr 2, 2025
…tion is not found (apache#47648)

When a Task SDK connection is not found, it currently throws AirflowRuntimeError. This PR catches it in this case and raises AirflowNotFoundException for consistency.
nailo2c pushed a commit to nailo2c/airflow that referenced this pull request Apr 4, 2025
…tion is not found (apache#47648)

When a Task SDK connection is not found, it currently throws AirflowRuntimeError. This PR catches it in this case and raises AirflowNotFoundException for consistency.
ramitkataria added a commit to aws-mwaa/upstream-to-airflow that referenced this pull request May 8, 2025
In one of my previus PRs (apache#47648), I incorrectly assumed that catching the
exception from `secrets_backend.get_connection` was meant for the
connection not found case. So, I'm reversing a couple of changes from
that PR for consistency.
ferruzzi pushed a commit that referenced this pull request May 12, 2025
* Fix consistency in exception/log handling in `connection.py`

In one of my previus PRs (#47648), I incorrectly assumed that catching the
exception from `secrets_backend.get_connection` was meant for the
connection not found case. So, I'm reversing a couple of changes from
that PR for consistency.

* Change log message
sanederchik pushed a commit to sanederchik/airflow that referenced this pull request Jun 7, 2025
…50329)

* Fix consistency in exception/log handling in `connection.py`

In one of my previus PRs (apache#47648), I incorrectly assumed that catching the
exception from `secrets_backend.get_connection` was meant for the
connection not found case. So, I'm reversing a couple of changes from
that PR for consistency.

* Change log message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:amazon AWS/Amazon - related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants