dabla commented on code in PR #55068:
URL: https://github.com/apache/airflow/pull/55068#discussion_r2988224399
##########
airflow-core/src/airflow/triggers/base.py:
##########
@@ -66,14 +79,56 @@ class BaseTrigger(abc.ABC, LoggingMixin):
supports_triggerer_queue: bool = True
def __init__(self, **kwargs):
+ super().__init__()
# these values are set by triggerer when preparing to run the instance
# when run, they are injected into logger record.
- self.task_instance = None
+ self._task_instance = None
self.trigger_id = None
+ self.template_fields = ()
+ self.template_ext = ()
+ self.task_id = None
def _set_context(self, context):
"""Part of LoggingMixin and used mainly for configuration of task
logging; not used for triggers."""
- raise NotImplementedError
+ pass
Review Comment:
It must otherwise following test fails:
```
___________________________________________________________ ERROR collecting
airflow-core/tests/unit/serialization/test_serialized_objects.py
____________________________________________________________
airflow-core/tests/unit/serialization/test_serialized_objects.py:397: in
<module>
watchers=[AssetWatcher(name="test",
trigger=FileDeleteTrigger(filepath="/tmp"))],
providers/standard/src/airflow/providers/standard/triggers/file.py:108: in
__init__
super().__init__()
airflow-core/src/airflow/triggers/base.py:82: in __init__
super().__init__()
airflow-core/src/airflow/utils/log/logging_mixin.py:83: in __init__
self._set_context(context)
airflow-core/src/airflow/triggers/base.py:93: in _set_context
raise NotImplementedError
E NotImplementedError
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]