amoghrajesh commented on code in PR #34457: URL: https://github.com/apache/airflow/pull/34457#discussion_r1456873011
########## airflow/jobs/job.py: ########## @@ -126,7 +127,19 @@ def executor(self): def heartrate(self) -> float: return Job._heartrate(self.job_type) - def is_alive(self, grace_multiplier=2.1) -> bool: + @cached_property Review Comment: Will we be able to add a unit test for this? ########## airflow/jobs/job.py: ########## @@ -126,7 +127,19 @@ def executor(self): def heartrate(self) -> float: return Job._heartrate(self.job_type) - def is_alive(self, grace_multiplier=2.1) -> bool: + @cached_property + def health_check_threshold(self) -> int | float: + grace_multiplier: float = 2.1 Review Comment: +1 agree with you here ########## airflow/jobs/job.py: ########## @@ -201,12 +215,15 @@ def heartbeat( job = Job._update_heartbeat(job=self, session=session) self._merge_from(job) - + time_since_last_heartbeat = (timezone.utcnow() - previous_heartbeat).total_seconds() + if time_since_last_heartbeat > self.health_check_threshold: + self.log.info("INFO: Heartbeat recovered after %.2f seconds", time_since_last_heartbeat) Review Comment: We do not need to add the "INFO:". It will be taken care by the logger -- 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: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org