-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Ensure that Connection extra can get masked without causing an error #54769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Fixes #54768 This was caused by pydantic#9541 and improper testing on my part. Sorry folks. Thsi happens because `Iterable` is too open-ended a type Yes, this should absolutely have unit tests to go with the fix, but a fix is better than nothing, and I'm about to leave on a camping holiday.
|
Hi |
potiuk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Damn. Pydantic runtime type usage has side effects - that change looks lile it changes nothing....
@ashb wrote:
I guess we should add unit tests as follow-up without breaking @ashb's plans. |
|
Anyone hitting this on 3.0.5 andwho doesn't want to rollback to 3.0.4: a work around for now is to manually apply this patch to your Airflow. If you are using docker to deploy your airflow then something like this should help hopefully: USER root
RUN apt update && apt install -y patch patchutils
RUN set -ex; \
cd /usr/local/lib/python3.12/site-packages/airflow; \
curl -L https://patch-diff.githubusercontent.com/raw/apache/airflow/pull/54769.patch \
| filterdiff -p1 -i 'task-sdk/src/airflow/*' | patch -p4 -u --verbose
USER airflowThe path to |
I manually tested it with this: First set the conneciton: export AIRFLOW_CONN_TEST='{"conn_type": "google_cloud_default", "extra": {"key_path": "/files/airflow-breeze-config/keys2/keys.json", "scope": "https://www.googleapis.com/auth/cloud-platform", "project": "project_id", "num_retries": 6}}Than I ran this DAG: @task
def my_function() -> None:
conn = Connection.get("test")
print(f"{conn.conn_id=} {conn.password=} {conn.extra_dejson=} {conn=}")
with DAG("test_dag") as dag:
my_function() |
I will take it from now on @ashb -> thanks for the repro scenarios |
amoghrajesh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Damn!
|
@ashb mypy will need a fix: |
I'll copy the PR and fix it -> and I will ask others to help :) .. @ashb will not be available to fix it @amoghrajesh |
|
Ah... It's in `apache/airflow" so we can push to it directly |
|
Originally, there was also the problem with triggerers with the following errors: do you think we can also fix the types for masks to solve this problem too? |
|
oh geeee... |
|
@potiuk you can push directly to the PR. No need to copy it. |
Yep. Will do |
|
We can work together @amoghrajesh -> and add more related fixes possibly (looking at the last comment from @VladaZakharova ). |
|
Let's just push fixups without -f : to not override each-others's changes. |
|
Dropped you a message on slack, looking into mypy failures |
|
pushed mypy fix :) |
will be happy to discuss and help, because now it looks like if we extend this logic with types, maybe we can also add support of Enums and other types that are not standard. Because the current logic only supports limited number of objects. The problem with triggers was the first one, and now with this masking it's just making clear with connections that it doesn't work as expected |
Let's focus on getting unit testing for that one first - and then we can see what we can do with Enums - this one is pretty burning :). |
agree :) |
|
Agreed too. Let's fix the error at hand first and we can always follow up for the non breaking / burning things... |
|
fixup with tests is here |
|
Also @VladaZakharova -> those seem to be unrelated, it seems that simply we would have to add custom serializer to pydantic to handle those enums and classes that are being serialized. How do you arrive at those errors? |
|
Yeah I do not think it is directly linked to this PR |
Yeah unrelated |
…out causing an error
amoghrajesh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
|
Compat test change: #54776 |
|
Merging it 3.0.5 fails clearly because of yanking :) and #54766 is already on the way. |
…ng an error (#54769) * Ensure that Connection extra can get masked without causing an error Fixes #54768 This was caused by pydantic#9541 and improper testing on my part. Sorry folks. Thsi happens because `Iterable` is too open-ended a type Yes, this should absolutely have unit tests to go with the fix, but a fix is better than nothing, and I'm about to leave on a camping holiday. * fixup! Ensure that Connection extra can get masked without causing an error * fixup! fixup! Ensure that Connection extra can get masked without causing an error * fixup! fixup! fixup! Ensure that Connection extra can get masked without causing an error --------- (cherry picked from commit 5aec867) Co-authored-by: Ash Berlin-Taylor <ash@apache.org> Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
…ng an error (#54769) (#54780) * Ensure that Connection extra can get masked without causing an error Fixes #54768 This was caused by pydantic#9541 and improper testing on my part. Sorry folks. Thsi happens because `Iterable` is too open-ended a type Yes, this should absolutely have unit tests to go with the fix, but a fix is better than nothing, and I'm about to leave on a camping holiday. * fixup! Ensure that Connection extra can get masked without causing an error * fixup! fixup! Ensure that Connection extra can get masked without causing an error * fixup! fixup! fixup! Ensure that Connection extra can get masked without causing an error --------- (cherry picked from commit 5aec867) Co-authored-by: Ash Berlin-Taylor <ash@apache.org> Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
…ng an error (#54769) (#54780) * Ensure that Connection extra can get masked without causing an error Fixes #54768 This was caused by pydantic#9541 and improper testing on my part. Sorry folks. Thsi happens because `Iterable` is too open-ended a type Yes, this should absolutely have unit tests to go with the fix, but a fix is better than nothing, and I'm about to leave on a camping holiday. * fixup! Ensure that Connection extra can get masked without causing an error * fixup! fixup! Ensure that Connection extra can get masked without causing an error * fixup! fixup! fixup! Ensure that Connection extra can get masked without causing an error --------- (cherry picked from commit 5aec867) Co-authored-by: Ash Berlin-Taylor <ash@apache.org> Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
…pache#54769) * Ensure that Connection extra can get masked without causing an error Fixes apache#54768 This was caused by pydantic#9541 and improper testing on my part. Sorry folks. Thsi happens because `Iterable` is too open-ended a type Yes, this should absolutely have unit tests to go with the fix, but a fix is better than nothing, and I'm about to leave on a camping holiday. * fixup! Ensure that Connection extra can get masked without causing an error * fixup! fixup! Ensure that Connection extra can get masked without causing an error * fixup! fixup! fixup! Ensure that Connection extra can get masked without causing an error --------- Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
Fixes #54768
This was caused by pydantic#9541 and improper testing on my part. Sorry
folks. Thsi happens because
Iterableis too open-ended a typeYes, this should absolutely have unit tests to go with the fix, but a fix is
better than nothing, and I'm about to leave on a camping holiday.
^ 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.rstor{issue_number}.significant.rst, in airflow-core/newsfragments.