def service_is_up(service):
 last_heartbeat = (service['updated_at'] or service['created_at'])
 elapsed = total_seconds((timeutils.utcnow() - last_heartbeat))
 return (abs(elapsed) <= FLAGS.service_down_time)

def service_is_up ( service ) : last_heartbeat = ( service [ 'updated_at' ] or service [ 'created_at' ] ) elapsed = total_seconds ( ( timeutils . utcnow ( ) - last_heartbeat ) ) return ( abs ( elapsed ) <= FLAGS . service_down_time )
check whether a service is up based on last heartbeat .