diff --git a/module_build_service/scheduler/handlers/modules.py b/module_build_service/scheduler/handlers/modules.py index b6bfa13d..3cbb7855 100644 --- a/module_build_service/scheduler/handlers/modules.py +++ b/module_build_service/scheduler/handlers/modules.py @@ -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'], diff --git a/module_build_service/utils.py b/module_build_service/utils.py index 3dd30517..2655b7c4 100644 --- a/module_build_service/utils.py +++ b/module_build_service/utils.py @@ -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 diff --git a/tests/test_build/test_build.py b/tests/test_build/test_build.py index a94db2c8..5239bc61 100644 --- a/tests/test_build/test_build.py +++ b/tests/test_build/test_build.py @@ -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':