Allow configuring the number of parallel submissions to Koji

When NUM_CONCURRENT_BUILDS is 0, then multi-threading is disabled
when submitting builds to Koji. This is not acceptable, so this
commit makes the number of threads configurable.
This commit is contained in:
mprahl
2019-06-28 16:59:46 -04:00
parent fadbc26994
commit 50f0a60ec1
2 changed files with 15 additions and 4 deletions

View File

@@ -653,7 +653,13 @@ class Config(object):
"x, y, and z (represents the version). The third value is an optional template "
"string that represent the Product Pages release for major releases "
"(e.g. 8.0.0). After the first match, the rest will be ignored."
}
},
"num_threads_for_build_submissions": {
"type": int,
"default": 5,
"desc": "The number of threads when submitting component builds to an external build "
"system.",
},
}
def __init__(self, conf_section_obj):
@@ -907,3 +913,10 @@ class Config(object):
)
self._product_pages_module_streams = d
def _setifok_num_threads_for_build_submissions(self, i):
if not isinstance(i, int):
raise TypeError("NUM_THREADS_FOR_BUILD_SUBMISSIONS needs to be an int")
if i < 1:
raise ValueError("NUM_THREADS_FOR_BUILD_SUBMISSIONS must be >= 1")
self._num_threads_for_build_submissions = i

View File

@@ -150,9 +150,7 @@ def continue_batch_build(config, module, session, builder, components=None):
components_to_build.append(c)
# Start build of components in this batch.
max_workers = 1
if config.num_concurrent_builds > 0:
max_workers = config.num_concurrent_builds
max_workers = config.num_threads_for_build_submissions
with concurrent.futures.ThreadPoolExecutor(max_workers=max_workers) as executor:
futures = {
executor.submit(start_build_component, builder, c): c for c in components_to_build