You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2019/04/30 20:38:05 UTC
[GitHub] [airflow] kaxil commented on a change in pull request #5127:
[AIRFLOW-4343] Show warning in UI if scheduler is not running
kaxil 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_r279926204
##########
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:
Can we change the type hints to the one defined by https://www.python.org/dev/peps/pep-0484/
as we already have a PR open to do the same for remaining code: https://github.com/apache/airflow/pull/5030
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services