diff --git a/awx/main/management/commands/provision_instance.py b/awx/main/management/commands/provision_instance.py index 75c297e8f0..b996db4125 100644 --- a/awx/main/management/commands/provision_instance.py +++ b/awx/main/management/commands/provision_instance.py @@ -38,7 +38,14 @@ class Command(BaseCommand): (changed, instance) = Instance.objects.register(ip_address=os.environ.get('MY_POD_IP'), node_type='control', uuid=settings.SYSTEM_UUID) RegisterQueue(settings.DEFAULT_CONTROL_PLANE_QUEUE_NAME, 100, 0, [], is_container_group=False).register() RegisterQueue( - settings.DEFAULT_EXECUTION_QUEUE_NAME, 100, 0, [], is_container_group=True, pod_spec_override=settings.DEFAULT_EXECUTION_QUEUE_POD_SPEC_OVERRIDE + settings.DEFAULT_EXECUTION_QUEUE_NAME, + 100, + 0, + [], + is_container_group=True, + pod_spec_override=settings.DEFAULT_EXECUTION_QUEUE_POD_SPEC_OVERRIDE, + max_forks=settings.DEFAULT_EXECUTION_QUEUE_MAX_FORKS, + max_concurrent_jobs=settings.DEFAULT_EXECUTION_QUEUE_MAX_CONCURRENT_JOBS, ).register() else: (changed, instance) = Instance.objects.register(hostname=hostname, node_type=node_type, uuid=uuid) diff --git a/awx/main/management/commands/register_queue.py b/awx/main/management/commands/register_queue.py index 3268dc0ebc..36b7d17b1b 100644 --- a/awx/main/management/commands/register_queue.py +++ b/awx/main/management/commands/register_queue.py @@ -17,7 +17,9 @@ class InstanceNotFound(Exception): class RegisterQueue: - def __init__(self, queuename, instance_percent, inst_min, hostname_list, is_container_group=None, pod_spec_override=None): + def __init__( + self, queuename, instance_percent, inst_min, hostname_list, is_container_group=None, pod_spec_override=None, max_forks=None, max_concurrent_jobs=None + ): self.instance_not_found_err = None self.queuename = queuename self.instance_percent = instance_percent @@ -25,6 +27,8 @@ class RegisterQueue: self.hostname_list = hostname_list self.is_container_group = is_container_group self.pod_spec_override = pod_spec_override + self.max_forks = max_forks + self.max_concurrent_jobs = max_concurrent_jobs def get_create_update_instance_group(self): created = False @@ -45,6 +49,14 @@ class RegisterQueue: ig.pod_spec_override = self.pod_spec_override changed = True + if self.max_forks and (ig.max_forks != self.max_forks): + ig.max_forks = self.max_forks + changed = True + + if self.max_concurrent_jobs and (ig.max_concurrent_jobs != self.max_concurrent_jobs): + ig.max_concurrent_jobs = self.max_concurrent_jobs + changed = True + if changed: ig.save() diff --git a/awx/settings/defaults.py b/awx/settings/defaults.py index e365c2a48f..577bee627f 100644 --- a/awx/settings/defaults.py +++ b/awx/settings/defaults.py @@ -983,6 +983,13 @@ DJANGO_GUID = {'GUID_HEADER_NAME': 'X-API-Request-Id'} DEFAULT_EXECUTION_QUEUE_NAME = 'default' # pod spec used when the default execution queue is a container group, e.g. when deploying on k8s/ocp with the operator DEFAULT_EXECUTION_QUEUE_POD_SPEC_OVERRIDE = '' +# Max number of concurrently consumed forks for the default execution queue +# Zero means no limit +DEFAULT_EXECUTION_QUEUE_MAX_FORKS = 0 +# Max number of concurrently running jobs for the default execution queue +# Zero means no limit +DEFAULT_EXECUTION_QUEUE_MAX_CONCURRENT_JOBS = 0 + # Name of the default controlplane queue DEFAULT_CONTROL_PLANE_QUEUE_NAME = 'controlplane'