Lint BuildManager
This commit is contained in:
parent
043a30ee96
commit
6df6f28edf
9 changed files with 187 additions and 173 deletions
|
@ -8,7 +8,7 @@ from buildman.buildcomponent import BuildComponent
|
|||
from trollius.coroutines import From
|
||||
|
||||
REGISTRATION_REALM = 'registration'
|
||||
logger = logging.getLogger(__name__)
|
||||
LOGGER = logging.getLogger(__name__)
|
||||
|
||||
class DynamicRegistrationComponent(BaseComponent):
|
||||
""" Component session that handles dynamic registration of the builder components. """
|
||||
|
@ -17,12 +17,12 @@ class DynamicRegistrationComponent(BaseComponent):
|
|||
self.join(REGISTRATION_REALM)
|
||||
|
||||
def onJoin(self, details):
|
||||
logger.debug('Registering registration method')
|
||||
LOGGER.debug('Registering registration method')
|
||||
yield From(self.register(self._worker_register, u'io.quay.buildworker.register'))
|
||||
|
||||
def _worker_register(self):
|
||||
realm = self.parent_manager.add_build_component()
|
||||
logger.debug('Registering new build component+worker with realm %s', realm)
|
||||
LOGGER.debug('Registering new build component+worker with realm %s', realm)
|
||||
return realm
|
||||
|
||||
|
||||
|
@ -35,8 +35,9 @@ class EnterpriseManager(BaseManager):
|
|||
# Add a component which is used by build workers for dynamic registration. Unlike
|
||||
# production, build workers in enterprise are long-lived and register dynamically.
|
||||
self.register_component(REGISTRATION_REALM, DynamicRegistrationComponent)
|
||||
|
||||
|
||||
def add_build_component(self):
|
||||
""" Adds a new build component for an Enterprise Registry. """
|
||||
# Generate a new unique realm ID for the build worker.
|
||||
realm = str(uuid.uuid4())
|
||||
component = self.register_component(realm, BuildComponent, token="")
|
||||
|
@ -44,6 +45,7 @@ class EnterpriseManager(BaseManager):
|
|||
return realm
|
||||
|
||||
def schedule(self, build_job, loop):
|
||||
""" Schedules a build for an Enterprise Registry. """
|
||||
if self.shutting_down:
|
||||
return False
|
||||
|
||||
|
|
Reference in a new issue