scheduler host_manager needs service for filters
distributed scheduler isn't checking service_is_up or services['disabled'] due to filters not having access to service. Fixed both. Since ec2 API also uses service_down_time, I moved service_is_up() into utils and made ec2 use it. Change-Id: I0321844a47031b2de4d8738e032a4634edd1e945
This commit is contained in:
parent
92e66df6e7
commit
12068866f7
@ -1399,3 +1399,11 @@ def _showwarning(message, category, filename, lineno, file=None, line=None):
|
||||
|
||||
# Install our warnings handler
|
||||
warnings.showwarning = _showwarning
|
||||
|
||||
|
||||
def service_is_up(service):
|
||||
"""Check whether a service is up based on last heartbeat."""
|
||||
last_heartbeat = service['updated_at'] or service['created_at']
|
||||
# Timestamps in DB are UTC.
|
||||
elapsed = total_seconds(utcnow() - last_heartbeat)
|
||||
return abs(elapsed) <= FLAGS.service_down_time
|
||||
|
Loading…
x
Reference in New Issue
Block a user