This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 7d555d7 Relax timetable clas validation (#19878)
7d555d7 is described below
commit 7d555d779dc83566d814a36946bd886c2e7468b3
Author: Tzu-ping Chung <[email protected]>
AuthorDate: Tue Nov 30 00:50:23 2021 +0800
Relax timetable clas validation (#19878)
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.
---
airflow/serialization/serialized_objects.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/airflow/serialization/serialized_objects.py
b/airflow/serialization/serialized_objects.py
index c542cd6..2559f1e 100644
--- a/airflow/serialization/serialized_objects.py
+++ b/airflow/serialization/serialized_objects.py
@@ -146,7 +146,7 @@ def _encode_timetable(var: Timetable) -> Dict[str, Any]:
"""
timetable_class = type(var)
importable_string = as_importable_string(timetable_class)
- if _get_registered_timetable(importable_string) != timetable_class:
+ if _get_registered_timetable(importable_string) is None:
raise _TimetableNotRegistered(importable_string)
return {Encoding.TYPE: importable_string, Encoding.VAR: var.serialize()}