dabla commented on code in PR #55068:
URL: https://github.com/apache/airflow/pull/55068#discussion_r2772622778
##########
airflow-core/src/airflow/triggers/base.py:
##########
@@ -64,14 +77,67 @@ class BaseTrigger(abc.ABC, LoggingMixin):
"""
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 = ()
def _set_context(self, context):
"""Part of LoggingMixin and used mainly for configuration of task
logging; not used for triggers."""
- raise NotImplementedError
+ pass
+
+ @property
+ def task(self) -> Operator | None:
+ if self.task_instance:
+ return self.task_instance.task
+ return None
+
+ @property
+ def task_instance(self) -> TaskInstance:
Review Comment:
Can't do that as this will break the google triggerers, I propose to do this
refactoring in separate PR, I know because I did it like that before and that
broke the google triggerers, which I don't want to modify in this PR.
--
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]