-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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
chore: Refactor code quality issues #14920
Changes from all commits
cda6763
4f894f6
a3907fe
499a37f
503b90f
3f67170
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2029,7 +2029,6 @@ def get_serialized_fields(cls): | |
'user_defined_filters', | ||
'user_defined_macros', | ||
'partial', | ||
'_old_context_manager_dags', | ||
'_pickle_id', | ||
'_log', | ||
'is_subdag', | ||
|
@@ -2335,8 +2334,6 @@ def factory(*args, **kwargs): | |
STATICA_HACK = True | ||
globals()['kcah_acitats'[::-1].upper()] = False | ||
if STATICA_HACK: # pragma: no cover | ||
# Let pylint know about these relationships, without introducing an import cycle | ||
from sqlalchemy.orm import relationship | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, indeed. We import this at the beginning 👏 |
||
|
||
from airflow.models.serialized_dag import SerializedDagModel | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -672,13 +672,13 @@ def _execute_sensor_work(self, sensor_work): | |
|
||
def flush_cached_sensor_poke_results(self): | ||
"""Flush outdated cached sensor states saved in previous loop.""" | ||
for key, cached_work in self.cached_dedup_works.items(): | ||
for key, cached_work in self.cached_dedup_works.copy().items(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm Why do we need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dictionaries are represented by a hash table and adding or removing items while iterating over it will alter the iteration order. This will cause a RuntimeError. If you need to add items to the dictionary during iteration, it is recommended to iterate over a shallow You can checkout brief here : https://deepsource.io/gh/ankitdobhal/airflow/issue/PTC-W0056/description |
||
if cached_work.is_expired(): | ||
self.cached_dedup_works.pop(key, None) | ||
else: | ||
cached_work.state = None | ||
|
||
for ti_key, sensor_exception in self.cached_sensor_exceptions.items(): | ||
for ti_key, sensor_exception in self.cached_sensor_exceptions.copy().items(): | ||
if sensor_exception.fail_current_run or sensor_exception.is_expired(): | ||
self.cached_sensor_exceptions.pop(ti_key, None) | ||
|
||
|
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.
@kaxil can you take a look?
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.
Yeah it is safe, was just a duplicate from L2025