For mock backend, build all the components in batch in single continue_batch_build call.

This commit is contained in:
Jan Kaluza
2017-03-28 12:48:35 +02:00
parent ba19f28878
commit 597973da98
3 changed files with 17 additions and 6 deletions

View File

@@ -155,7 +155,7 @@ def wait(config, session, msg):
tag = None
dependencies = []
if conf.system in ["mock", "copr"]:
if conf.system != "koji":
# In case of mock, we do not try to get anything from pdc,
# just generate our own koji_tag to identify the module in messages.
tag = '-'.join(['module', module_info['name'],

View File

@@ -82,6 +82,17 @@ def at_concurrent_component_threshold(config, session):
this time
"""
# We must not check it for "mock" backend.
# It would lead to multiple calls of continue_batch_build method and
# creation of multiple worker threads there. Mock backend uses thread-id
# to create and identify mock buildroot and for mock backend, we must
# build whole module in this single continue_batch_build call to keep
# the number of created buildroots low. The concurrent build limit
# for mock backend is secured by setting max_workers in
# ThreadPoolExecutor to num_consecutive_builds.
if conf.system == "mock":
return False
import koji # Placed here to avoid py2/py3 conflicts...
if config.num_consecutive_builds and config.num_consecutive_builds <= \
@@ -148,9 +159,9 @@ def continue_batch_build(config, module, session, builder, components=None):
previous_component_build = get_reusable_component(
session, module, c.package)
# If a component build can't be reused, we need to check
# the concurrent threshold
if not previous_component_build and \
at_concurrent_component_threshold(config, session):
# the concurrent threshold.
if (not previous_component_build
and at_concurrent_component_threshold(config, session)):
log.info('Concurrent build threshold met')
break

View File

@@ -80,7 +80,7 @@ class TestModuleBuilder(GenericBuilder):
Test module builder which succeeds for every build.
"""
backend = "mock"
backend = "test"
# Global build_id/task_id we increment when new build is executed.
_build_id = 1
@@ -205,7 +205,7 @@ class TestModuleBuilder(GenericBuilder):
@patch("module_build_service.config.Config.system",
new_callable=PropertyMock, return_value = "mock")
new_callable=PropertyMock, return_value = "test")
@patch("module_build_service.builder.GenericBuilder.default_buildroot_groups",
return_value={
'srpm-build':