Skip to content

Commit 0e67e72

Browse files
committed
Throttling: apply changes requested in PR6952
Update openqa.ini parameter description Fix the t/ui/10-tests_overview.t u.test for CI Move in a routine the format prechecks of the throttling parameter
1 parent 51325fb commit 0e67e72

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

etc/openqa/openqa.ini

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -369,12 +369,14 @@ concurrent = 0
369369
## scheduled products without any jobs (e.g. due to errors) are not immediately
370370
## cleaned up.
371371
#scheduled_product_min_storage_duration = 34
372-
## Job resources throttling configuration:
373-
## a string of comma-separated jobs resources,
374-
## formatted like: "RES1:MAL1,RES2:MAL2,..."
375-
## where MAL# is a malus priority to multiply for RES value
376-
## PRIO1 = prio_base + int(RES1.val * MAL1)
377-
#prio_throttling_parameters
372+
## Throttling
373+
## A comma-separated list of test parameters eachone followed by a colon and a scaling factor,
374+
## to trigger throttling by priority of scheduled openQA job, for any matched job setting.
375+
## Example: 'prio_throttling_parameters = 'QEMURAM:.003,HDDSIZEGB:.05,RETRY:1'.
376+
## The scaling factor is a decimal value that the parameter's value is multiplied by and added to the job prio,
377+
## according to the formula: priority = '$base_prio + int($<value of parameter1> * $<prio_throttling_scale of parameter1>) + ...'.
378+
## Example: a parameter 'RETRY' = 1, 'prio_throttling_scale of retry' = 3, 'base prio' = 50, provides a job prio of '50 + 1*3=53'
379+
#prio_throttling_parameters =
378380

379381
[archiving]
380382
## Moves logs of jobs which are preserved during the cleanup because they are

lib/OpenQA/Schema/ResultSet/Jobs.pm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ sub latest_jobs ($self, $until = undef) {
102102
}
103103

104104
sub load_throttling_config ($config_string) {
105-
# parse to hash "{ PAR1 => MAL1, PAR2 => MAL2, ...}"
106-
# the prio_throttling_parameters configuration string; see openqa.ini
105+
# convert in hash the prio_throttling_parameters string configured in openqa.ini
107106
return unless ($config_string && $config_string =~ /:/);
108107
$config_string =~ s/\s+//g;
109108
my %hash = map { my ($k, $v) = split /:/, $_, 2 } split /,/, $config_string;

lib/OpenQA/Setup.pm

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,15 @@ sub _load_config ($app, $defaults, $mode_specific_defaults) {
6161
return $config;
6262
}
6363

64+
sub validate_prio_throttling_format ($config) {
65+
my $throttling = $config->{misc_limits}->{prio_throttling_parameters};
66+
if ($throttling && length $throttling) {
67+
$config->{misc_limits}->{prio_throttling_parameters} =~ s/\s+//g;
68+
die("Wrong formatting for 'prio_throttling_parameters' in openqa.ini")
69+
unless ($throttling =~ /^[A-Z_]+:\d+(?:,[A-Z_]+:\d+)*$/i);
70+
}
71+
}
72+
6473
sub read_config ($app) {
6574
my %defaults = (
6675
global => {
@@ -294,12 +303,9 @@ sub read_config ($app) {
294303
if (my $minion_fail_job_blocklist = $config->{influxdb}->{ignored_failed_minion_jobs}) {
295304
$config->{influxdb}->{ignored_failed_minion_jobs} = [split(/\s+/, $minion_fail_job_blocklist)];
296305
}
297-
my $throttling = $config->{misc_limits}->{prio_throttling_parameters};
298-
if ($throttling && length $throttling) {
299-
$config->{misc_limits}->{prio_throttling_parameters} =~ s/\s+//g;
300-
die("Wrong formatting for 'prio_throttling_parameters' in openqa.ini")
301-
unless ($throttling =~ /^[A-Z_]+:\d+(?:,[A-Z_]+:\d+)*$/i);
302-
}
306+
307+
validate_prio_throttling_format($config);
308+
303309
my $results = delete $global_config->{parallel_children_collapsable_results};
304310
$global_config->{parallel_children_collapsable_results_sel}
305311
= ' .status' . join('', map { ":not(.result_$_)" } split(/\s+/, $results));

0 commit comments

Comments
 (0)