From b1217921aae182142e779e72baf33d9118aba767 Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Thu, 23 Mar 2017 15:28:24 +0100 Subject: [PATCH] Create the build in components.py handler only when we really need it. --- .../scheduler/handlers/components.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/module_build_service/scheduler/handlers/components.py b/module_build_service/scheduler/handlers/components.py index 7db45aad..3d190c0f 100644 --- a/module_build_service/scheduler/handlers/components.py +++ b/module_build_service/scheduler/handlers/components.py @@ -75,18 +75,6 @@ def _finalize(config, session, msg, state): session.commit() return - # Initialize the builder, we will need it later. - module_name = parent.name - tag = parent.koji_tag - builder = module_build_service.builder.GenericBuilder.create( - parent.owner, module_name, config.system, config, tag_name=tag, - components=[c.package for c in parent.component_builds]) - - groups = module_build_service.builder.GenericBuilder.default_buildroot_groups( - session, parent) - - builder.buildroot_connect(groups) - further_work = [] # If there are no other components still building in a batch, @@ -101,6 +89,9 @@ def _finalize(config, session, msg, state): if c.state == koji.BUILD_STATES['COMPLETE'] ] + builder = module_build_service.builder.GenericBuilder.create_from_module( + session, parent, config) + if not built_components_in_batch: # If there are no successfully built components in a batch, # there is nothing to tag and therefore the repository won't @@ -130,6 +121,8 @@ def _finalize(config, session, msg, state): # done in repos.py:done(...), but because we have just finished one # build, try to call continue_batch_build again so in case we hit the # threshold previously, we will submit another build from this batch. + builder = module_build_service.builder.GenericBuilder.create_from_module( + session, parent, config) further_work += module_build_service.utils.continue_batch_build( config, parent, session, builder) return further_work