uranusjr commented on code in PR #33084:
URL: https://github.com/apache/airflow/pull/33084#discussion_r1288066172


##########
airflow/jobs/job.py:
##########
@@ -117,6 +115,15 @@ def __init__(self, executor=None, heartrate=None, 
**kwargs):
     def executor(self):
         return ExecutorLoader.get_default_executor()
 
+    @cached_property
+    def heartrate(self):
+        if self.job_type == "TriggererJob":
+            return conf.getfloat("triggerer", "JOB_HEARTBEAT_SEC")
+        else:
+            # Heartrate used to be hardcoded to scheduler, so in all other
+            # cases continue to use that value for back compat
+            return conf.getfloat("scheduler", "JOB_HEARTBEAT_SEC")

Review Comment:
   > The mechanics of 
[cached_property()](https://docs.python.org/3/library/functools.html#functools.cached_property)
 are somewhat different from 
[property()](https://docs.python.org/3/library/functions.html#property). A 
regular property blocks attribute writes unless a setter is defined. In 
contrast, a cached_property allows writes.
   
   https://docs.python.org/3/library/functools.html#functools.cached_property
   
   So I guess this is good then.



-- 
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]

Reply via email to