@@ -26,6 +26,8 @@ class HighAvailabilityOperator(PythonSensor):
26
26
_fail_trigger_kwargs : Optional [Dict [str , Any ]] = None
27
27
_fail_trigger_kwargs_conf : str = "{}"
28
28
29
+ _check_end_conditions : Optional [Callable ] = None
30
+
29
31
_runtime : Optional [timedelta ] = None
30
32
_endtime : Optional [time ] = None
31
33
_maxretrigger : Optional [int ] = None
@@ -69,7 +71,7 @@ def __init__(
69
71
self ._fail_trigger_kwargs_conf = self ._fail_trigger_kwargs .pop ("conf" , {})
70
72
71
73
# Function to check end conditions
72
- check_end_conditions = ( # noqa: E731
74
+ self . _check_end_conditions = ( # noqa: E731
73
75
lambda task_id = kwargs .get ("task_id" ),
74
76
runtime = self ._runtime ,
75
77
endtime = self ._endtime ,
@@ -86,7 +88,7 @@ def __init__(
86
88
)
87
89
88
90
# Function to control the sensor
89
- callable_wrapper = lambda python_callable = python_callable , check_end_conditions = check_end_conditions , ** kwargs : _callable_wrapper ( # noqa: E731
91
+ callable_wrapper = lambda python_callable = python_callable , check_end_conditions = self . _check_end_conditions , ** kwargs : _callable_wrapper ( # noqa: E731
90
92
python_callable = python_callable , check_end_conditions = check_end_conditions , ** kwargs
91
93
)
92
94
@@ -189,6 +191,10 @@ def retrigger_fail(self) -> TriggerDagRunOperator:
189
191
def retrigger_pass (self ) -> TriggerDagRunOperator :
190
192
return self ._retrigger_pass
191
193
194
+ @property
195
+ def check_end_conditions (self ) -> Callable :
196
+ return self ._check_end_conditions
197
+
192
198
193
199
# Function to check end conditions
194
200
def _check_end_conditions (task_id , runtime , endtime , maxretrigger , start_date_or_logical_date , ** kwargs ):
0 commit comments