ashb commented on a change in pull request #5127: [AIRFLOW-4343] Show warning 
in UI if scheduler is not running
URL: https://github.com/apache/airflow/pull/5127#discussion_r288477483
 
 

 ##########
 File path: airflow/jobs.py
 ##########
 @@ -94,25 +94,54 @@ class BaseJob(Base, LoggingMixin):
         Index('idx_job_state_heartbeat', state, latest_heartbeat),
     )
 
+    heartrate = conf.getfloat('scheduler', 'JOB_HEARTBEAT_SEC'),
+
     def __init__(
             self,
             executor=executors.get_default_executor(),
-            heartrate=conf.getfloat('scheduler', 'JOB_HEARTBEAT_SEC'),
+            heartrate=None,
             *args, **kwargs):
         self.hostname = get_hostname()
         self.executor = executor
         self.executor_class = executor.__class__.__name__
         self.start_date = timezone.utcnow()
         self.latest_heartbeat = timezone.utcnow()
-        self.heartrate = heartrate
+        if heartrate is not None:
+            self.heartrate = heartrate
         self.unixname = getpass.getuser()
         self.max_tis_per_query = conf.getint('scheduler', 'max_tis_per_query')
         super().__init__(*args, **kwargs)
 
-    def is_alive(self):
+    @classmethod
+    @provide_session
+    def most_recent_job(cls, session):  # type: (Session) -> Optional[BaseJob]
 
 Review comment:
   Done this now.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to