Generalize the ephemeral build managers so that any manager may manage a builder spawned by any other manager.

This commit is contained in:
Jake Moshenko 2014-12-31 11:33:56 -05:00
parent ccb19571d6
commit cc70225043
11 changed files with 258 additions and 125 deletions

View file

@ -5,7 +5,7 @@ from buildman.component.basecomponent import BaseComponent
from buildman.component.buildcomponent import BuildComponent
from buildman.manager.basemanager import BaseManager
from trollius.coroutines import From, Return, coroutine
from trollius import From, Return, coroutine, async
REGISTRATION_REALM = 'registration'
logger = logging.getLogger(__name__)
@ -51,16 +51,19 @@ class EnterpriseManager(BaseManager):
return realm
@coroutine
def schedule(self, build_job, loop):
def schedule(self, build_job):
""" Schedules a build for an Enterprise Registry. """
if self.shutting_down or not self.ready_components:
raise Return(False)
component = self.ready_components.pop()
loop.call_soon(component.start_build, build_job)
yield From(component.start_build(build_job))
raise Return(True)
def build_component_ready(self, build_component, loop):
@coroutine
def build_component_ready(self, build_component):
self.ready_components.add(build_component)
def shutdown(self):