diff --git a/module_build_service/scheduler/handlers/modules.py b/module_build_service/scheduler/handlers/modules.py index 760732c5..8cc6ff3d 100644 --- a/module_build_service/scheduler/handlers/modules.py +++ b/module_build_service/scheduler/handlers/modules.py @@ -137,6 +137,7 @@ def wait(config, session, msg): build = models.ModuleBuild.from_module_event(session, msg) if 'mbs' in build.mmd().xmd: return build + session.expire(build) raise RuntimeError("{!r} doesn't contain xmd information for MBS." .format(build)) diff --git a/module_build_service/scheduler/producer.py b/module_build_service/scheduler/producer.py index 116d035d..17e1d33c 100644 --- a/module_build_service/scheduler/producer.py +++ b/module_build_service/scheduler/producer.py @@ -179,7 +179,15 @@ class MBSProducer(PollingProducer): state=models.BUILD_STATES['build']).all(): # If there are no components in the build state on the module build, # then no possible event will start off new component builds - if not module_build.current_batch(koji.BUILD_STATES['BUILDING']): + unbuilt_components = [ + c for c in module_build.component_builds + if (c.state != koji.BUILD_STATES['COMPLETE'] + and c.state != koji.BUILD_STATES["FAILED"] + and c.state != koji.BUILD_STATES["CANCELED"]) + ] + + if (not module_build.current_batch(koji.BUILD_STATES['BUILDING']) + and unbuilt_components): # Initialize the builder... builder = GenericBuilder.create_from_module( session, module_build, config)