Lee-W commented on code in PR #34457:
URL: https://github.com/apache/airflow/pull/34457#discussion_r1329844912
##########
airflow/jobs/job.py:
##########
@@ -128,6 +129,16 @@ def heartrate(self):
# cases continue to use that value for back compat
return conf.getfloat("scheduler", "JOB_HEARTBEAT_SEC")
+ @cached_property
+ def health_check_threshold(self, grace_multiplier=2.1):
Review Comment:
```suggestion
def health_check_threshold(self, grace_multiplier: float = 2.1) -> float:
```
##########
airflow/jobs/job.py:
##########
@@ -213,9 +218,12 @@ def heartbeat(
session.merge(self)
self.latest_heartbeat = timezone.utcnow()
session.commit()
+ # After committing verify if heartbeat has recovered after
crossing health check threshold
Review Comment:
Should we add a test case for this behavior?
##########
airflow/jobs/job.py:
##########
@@ -128,6 +129,16 @@ def heartrate(self):
# cases continue to use that value for back compat
return conf.getfloat("scheduler", "JOB_HEARTBEAT_SEC")
+ @cached_property
+ def health_check_threshold(self, grace_multiplier=2.1):
+ if self.job_type == "SchedulerJob":
+ health_check_threshold_value: int = conf.getint("scheduler",
"scheduler_health_check_threshold")
+ elif self.job_type == "TriggererJob":
+ health_check_threshold_value: int = conf.getint("triggerer",
"triggerer_health_check_threshold")
+ else:
+ health_check_threshold_value: int = self.heartrate *
grace_multiplier
Review Comment:
Should these `int` be `float` instead?
--
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]