diff --git a/config.py b/config.py index d5e27caf..04eb4a0e 100644 --- a/config.py +++ b/config.py @@ -28,6 +28,10 @@ class BaseConfiguration(object): # Set to zero to disable polling POLLING_INTERVAL = 600 + # Determines how many builds that can be submitted to the builder + # and be in the build state at a time. Set this to 0 for no restrictions + NUM_CONSECUTIVE_BUILDS = 5 + RPMS_DEFAULT_REPOSITORY = 'git://pkgs.fedoraproject.org/rpms/' RPMS_ALLOW_REPOSITORY = False RPMS_DEFAULT_CACHE = 'http://pkgs.fedoraproject.org/repo/pkgs/' diff --git a/module_build_service/config.py b/module_build_service/config.py index f6937dbf..c03cd949 100644 --- a/module_build_service/config.py +++ b/module_build_service/config.py @@ -200,6 +200,10 @@ class Config(object): 'type': list, 'default': [], 'desc': 'Allowed SCM URLs.'}, + 'num_consecutive_builds': { + 'type': int, + 'default': 0, + 'desc': 'Number of consecutive component builds.'}, } def __init__(self): @@ -301,3 +305,10 @@ class Config(object): if not isinstance(l, list): raise TypeError("scmurls needs to be a list.") self.scmurls = [str(x) for x in l] + + def _setifok_num_consecutive_builds(self, i): + if not isinstance(i, int): + raise TypeError('NUM_CONSECUTIVE_BUILDS needs to be an int') + if i < 0: + raise ValueError('NUM_CONSECUTIVE_BUILDS must be >= 0') + self.num_consecutive_builds = i