copr-be: centralize aws/spot/hypervisor config in inventory

This commit is contained in:
Pavel Raiskup 2021-05-23 22:05:03 +02:00
parent 54a29eaaa1
commit 9b00f4b02a
5 changed files with 64 additions and 14 deletions

View file

@ -38,4 +38,16 @@ builders:
s390x: [0,0,0]
aarch64: [0,2,2]
#x86_hypervisor_01:
# x86_64: [2,1,1]
x86_hypervisor_02:
x86_64: [20,3,20]
x86_hypervisor_03:
x86_64: [20,3,20]
x86_hypervisor_04:
x86_64: [20,3,20]
rpm_vendor_copr_name: Fedora Copr

View file

@ -39,4 +39,16 @@ builders:
s390x: [1,0,0]
aarch64: [5,2,2]
#x86_hypervisor_01:
# x86_64: [2,1,1]
x86_hypervisor_02:
x86_64: [2,1,1]
x86_hypervisor_03:
x86_64: [2,1,1]
x86_hypervisor_04:
x86_64: [2,1,1]
rpm_vendor_copr_name: Fedora Copr (devel)

View file

@ -162,6 +162,31 @@
# - library
# tags:
# - provision_config
#
- name: calculate the maximum resalloc workers per architecture
set_fact: "max_{{ item }}_workers={{ builders | community.general.json_query('*.'+item+'[0]') | sum() }}"
with_items:
- x86_64
- armhfp
- s390x
- aarch64
tags:
- provision_config
- name: calculate max number of workers
set_fact: "max_workers={{ max_x86_64_workers|int + max_armhfp_workers|int + max_s390x_workers|int + max_aarch64_workers|int }}"
tags:
- provision_config
- name: print max arch workers
debug: "var=max_{{ item }}_workers"
with_items:
- x86_64
- armhfp
- s390x
- aarch64
tags:
- provision_config
- name: resalloc
import_tasks: resalloc.yml

View file

@ -38,13 +38,14 @@ sleeptime=20
# This option basically controls the amount of RAM allocated for
# processing builds on copr backend, and how many resalloc tickets can
# be taken at the same time.
builds_max_workers={{ builders.aws.x86_64[0] + builders.aws.aarch64[0] + builders.aws.armhfp[0] }}
builds_max_workers={{ max_workers }}
# Maximum number of concurrently running tasks per architecture.
builds_max_workers_arch=
x86_64={{ builders.aws.x86_64[0] }},
aarch64={{ builders.aws.aarch64[0]}},
armhfp={{ builders.aws.armhfp[0] }}
x86_64={{ max_x86_64_workers }},
aarch64={{ max_aarch64_workers }},
armhfp={{ max_armhfp_workers }},
s390x={{ max_s390x_workers }}
# Maximum number of concurrently running tasks per project owner.
{% if env == 'production' %}

View file

@ -49,17 +49,12 @@ aws_aarch64_{% if spot %}spot{% else %}normal{% endif %}_{% if devel %}dev{% els
{% endmacro %}
# x86_64 hypervisors
{% for hv in ["02", "03", "04"] %}
{% for hv in ["01", "02", "03", "04"] %}
{% if "x86_hypervisor_" + hv in builders %}
copr_hv_x86_64_{{ hv }}_{% if devel %}dev{% else %}prod{% endif %}:
{% if devel %}
max: 3
max_starting: 1
max_prealloc: 1
{% else %}
max: 20
max_starting: 4
max_prealloc: 20
{% endif %}
max: {{ builders["x86_hypervisor_" + hv]["x86_64"][0] }}
max_starting: {{ builders["x86_hypervisor_" + hv]["x86_64"][1] }}
max_prealloc: {{ builders["x86_hypervisor_" + hv]["x86_64"][2] }}
tags:
- copr_builder
- arch_x86_64
@ -85,6 +80,11 @@ copr_hv_x86_64_{{ hv }}_{% if devel %}dev{% else %}prod{% endif %}:
reuse_opportunity_time: 180
reuse_max_count: 8
reuse_max_time: 1800
{% else %}
#
# x86_hypervisor_{{ hv }} not configured in group_vars
#
{% endif %}
{% endfor %}
{% macro hw_aarch64(id, inst, max, max_starting, max_prealloc) %}