Add support for adjusting etcd ttl on job_heartbeat. Switch the heartbeat method to a coroutine.

This commit is contained in:
Jake Moshenko 2014-12-22 17:24:44 -05:00
parent 2b6c2a2a50
commit 34bf92673b
6 changed files with 62 additions and 13 deletions

View file

@ -3,13 +3,15 @@ from trollius import coroutine
class BaseManager(object):
""" Base for all worker managers. """
def __init__(self, register_component, unregister_component, job_heartbeat_callback,
job_complete_callback, public_ip_address):
job_complete_callback, public_ip_address, heartbeat_period_sec):
self.register_component = register_component
self.unregister_component = unregister_component
self.job_heartbeat_callback = job_heartbeat_callback
self.job_complete_callback = job_complete_callback
self.public_ip_address = public_ip_address
self.heartbeat_period_sec = heartbeat_period_sec
@coroutine
def job_heartbeat(self, build_job):
""" Method invoked to tell the manager that a job is still running. This method will be called
every few minutes. """