Skip to content

Conversation

@uranusjr
Copy link
Member

Airflow regularly reloads sys.modules, which makes type identity comparison unreliable, because a class would obtain a second, different identity in the interpreter when imported after a reload.

This makes validation difficult because there isn't really a way to tell whether two class objects are indeed "the same". But this check is only for sanity to begin with, so the best we can do is to drop the check entirely ans trust the Plugin Manager is doing its job correctly.

Fix #19869.

Airflow regularly reloads sys.modules, which makes type identity
comparison unreliable, because a class would obtain a second, different
identity in the interpreter when imported after a reload.

This makes validation difficult because there isn't really a way to
tell whether two class objects are indeed "the same". But this check is
only for sanity to begin with, so the best we can do is to drop the
check entirely ans trust the Plugin Manager is doing its job correctly.
@uranusjr uranusjr requested review from ashb and kaxil as code owners November 29, 2021 13:48
@uranusjr uranusjr added this to the Airflow 2.2.3 milestone Nov 29, 2021
@github-actions github-actions bot added the full tests needed We need to run full set of tests for this PR to merge label Nov 29, 2021
@github-actions
Copy link

The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.

@potiuk
Copy link
Member

potiuk commented Nov 29, 2021

Ah. That would explain why I had some problems in some of the tests with comparing classes.
I blamed it on Pytest but it looks this is Airfllow's fault :)

@potiuk potiuk merged commit 7d555d7 into apache:main Nov 29, 2021
dillonjohnson pushed a commit to dillonjohnson/airflow that referenced this pull request Dec 1, 2021
Airflow regularly reloads sys.modules, which makes type identity
comparison unreliable, because a class would obtain a second, different
identity in the interpreter when imported after a reload.

This makes validation difficult because there isn't really a way to
tell whether two class objects are indeed "the same". But this check is
only for sanity to begin with, so the best we can do is to drop the
check entirely ans trust the Plugin Manager is doing its job correctly.
jedcunningham pushed a commit that referenced this pull request Dec 7, 2021
Airflow regularly reloads sys.modules, which makes type identity
comparison unreliable, because a class would obtain a second, different
identity in the interpreter when imported after a reload.

This makes validation difficult because there isn't really a way to
tell whether two class objects are indeed "the same". But this check is
only for sanity to begin with, so the best we can do is to drop the
check entirely ans trust the Plugin Manager is doing its job correctly.

(cherry picked from commit 7d555d7)
@jedcunningham jedcunningham added the type:bug-fix Changelog: Bug Fixes label Dec 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:serialization full tests needed We need to run full set of tests for this PR to merge type:bug-fix Changelog: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom Timetable Import Error

3 participants